[gnu.g++] new

andrew@frip.WV.TEK.COM (Andrew Klossner) (09/20/89)

Michael said:

> For GNU C++ you say
> 	char *p = new { London } char[10];
> in AT&T C++ you say
> 	char *p = new ( London ) char[10];
> 
> You could do this in a header file:
> #ifdef __GNUG__
> #define NEW(WHERE) new { WHERE }
> #else
> #define NEW(WHERE) new ( WHERE )
> #endif

Or, without learning to capitalize new, you could do:

#ifdef __GNUG__
#define new(where) new { where }
#endif

A quick experiment suggests that GNU CPP doesn't try to expand
parametered macros when encountered without parameters.  Without this
behavior, this trick wouldn't work.

  -=- Andrew Klossner   (uunet!tektronix!frip.WV.TEK!andrew)    [UUCP]
                        (andrew%frip.wv.tek.com@relay.cs.net)   [ARPA]