Using std.stdio.File in a class

Spacen Jasset spacenjasset at mailrazer.com
Tue Apr 8 08:08:14 PDT 2014


On Tuesday, 8 April 2014 at 14:53:56 UTC, Adam D. Ruppe wrote:
> On Tuesday, 8 April 2014 at 14:52:02 UTC, Spacen Jasset wrote:
>> Are you not supposed to new structs anymore?
>
> Only if they're pointers. new File returns a File*, not a File.
>
> But you shouldn't new a File because then the file won't be 
> automatically closed when it goes out of scope (RAII indeed).
>
> Your code should work if you just take out the new keyword.

Perhaps the new keyword doesn't do what it used to do? I'll have 
to check all this out.


More information about the Digitalmars-d-learn mailing list