Topic: More advanced forms of macros?


Author: "Me" <anti_spam_email2003@yahoo.com>
Date: Sun, 22 Oct 2006 23:45:58 CST
Raw View
Have there ever been any experiments with something like:

a. "semi-colon eating" macros

  #define foo(a, b;) case ((a)+(b)):

  foo(a, b);

becomes

  case ((a)+(b)):

b. "block taking" macros:

  #define foo(a, b, {c}) switch (a) \
  { case (b): { c } break; default: blah; }

  foo(a, b) {
    outer1;
    {
      inner;
    }
    outer2;
  }

becomes:

switch (a) {
case (b):
  {
    outer1;
    {
      inner;
    }
    outer2;
  }
  break;
default:
  blah;
}



Maybe somebody thought of something like this before but they decided
against it because it might interact poorly with nested macros or be
fragile in some way?

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]