Article View: gnu.g++
Article #136new(fu) vs new{fu} (was how much of C++ 2.0 does g++ support?)
From: Andrew Klossner
Date: Tue, 19 Sep 1989 23:33
Date: Tue, 19 Sep 1989 23:33
26 lines
1283 bytes
1283 bytes
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]
Technical Details
Message-ID:
<4618@orca.WV.TEK.COM>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!zephyr.ens.tek.com!orca!frip!andrewReferences:
<42061@cmcl2.NYU.EDU> <8909191710.AA01547@teacake.sun.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!zephyr.ens.tek.com!orca!frip!andrew
From: andrew@frip.WV.TEK.COM (Andrew Klossner)
Newsgroups: gnu.g++
Subject: new(fu) vs new{fu} (was how much of C++ 2.0 does g++ support?)
Message-ID: <4618@orca.WV.TEK.COM>
Date: 19 Sep 89 23:33:56 GMT
References: <42061@cmcl2.NYU.EDU> <8909191710.AA01547@teacake.sun.com>
Sender: nobody@orca.WV.TEK.COM
Reply-To: andrew@frip.wv.tek.com
Distribution: gnu
Organization: Tektronix, Wilsonville, Oregon
Lines: 26