Thread View: comp.std.c++
1 messages
1 total messages
Started by dak
Thu, 07 Dec 1995 18:27
Re: new syntax for new operator
Author: dak
Date: Thu, 07 Dec 1995 18:27
Date: Thu, 07 Dec 1995 18:27
43 lines
1704 bytes
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. ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads