A Riddle: what is wrong with this code using std.array.Appender?
Daniel Kozak
kozzi11 at gmail.com
Mon Mar 25 22:39:26 UTC 2019
On Mon, Mar 25, 2019 at 4:00 PM FeepingCreature via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:
> class Class
> {
> Appender!(int[]) app = null;
> }
>
> This is the most evil bug I've seen this year yet.
>
> Hint: Appender is a struct, not a class. So what does "= null"
> do, when it appears as a default initializer?
>
>
Yeah I remember this bug. But to be honest I believe it is already fixed,
but few days ago I still write something like this to be sure:
class Class
{
Appender!(int[]) app;
this()
{
app = appender!(int[]);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20190325/c1e1a62c/attachment.html>
More information about the Digitalmars-d
mailing list