Proposal : allocations made easier with non nullable types.

Christopher Wright dhasenan at gmail.com
Wed Feb 11 05:27:09 PST 2009


Denis Koroskin wrote:
> Christopher Wright Wrote:
>> Any case in which the default constructor has side effects or 
>> preconditions is a problem.
> 
> 1) It is a valid C++ construct, and I don't remember having any problem with it.
> 
> 2) It's just a shortcut for Foo foo = new Foo(). If you don't plan to instanciate the instance immediately, i.e. you want to leave it as null, you should mark it as nullable:
> 
> Foo? foo; // no ctor call made

Okay, so your proposal relies on the nullable types proposal, which I 
dislike; and given the nullable types proposal, this is reasonable.



More information about the Digitalmars-d mailing list