🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2895

Re: new syntax for new operator

#2895
From: dak
Date: Thu, 07 Dec 1995 18:27
43 lines
1704 bytes
I wrote in a previous message:
> 
> -- Start example --
> 
> class A
> {

[snip...]

> static A a2;                 // static A object using declared default new.
> static A a2 = new (88,91) A; // static A object using overloaded new.
> 
> int main (void)
> {
> 	A a3;                 // auto A object with declared default new.
> 	A a4 = new (88,91) A; // auto A object with overloaded new.
> 

[snip...]

> As can be seen, the syntax does not break any existing code since it is
> currently illegal to assign the result of a new operation to the declared
> variable when the pointer types are not compatible (point 1).

Someone pointed out that the syntax could be confused if a constructor takes
a pointer to its own class as argument.  I had originally a different syntax
but changed it just before posting thinking the new one was more consistent.
Duh! Never change a post without thinking...  The original syntax had the
keywords in the calls:

static A a2 = static new (88,91) A;
...
A a4 = auto new (88, 91) A;

Now I believe it is a whole new syntax without possible confusion...



---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <Pine.A32.3.91.951207083707.21417A-100000@zorglub.cae.ca>
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!Matt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!Matt
From: dak <pierreba@poster.cae.ca>
Newsgroups: comp.std.c++
Subject: Re: new syntax for new operator
Date: 07 Dec 1995 18:27:06 GMT
Organization: <none>
Approved: Matt@Austern
Message-ID: <Pine.A32.3.91.951207083707.21417A-100000@zorglub.cae.ca>
NNTP-Posting-Host: austern.hip.berkeley.edu