if(arr) now a warning
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 10 01:38:00 PDT 2015
On 2015-04-09 22:59, Steven Schveighoffer wrote:
> As usual with changes of this nature, there are differing opinions, and
> differing styles. I personally never use null as a special value for an
> array, but others do. They use if(arr) to actually mean if(arr.ptr). For
> these cases, the update will cause some amount of busywork changing
> these checks.
>
> But when updating Phobos to comply with this change, we found several
> actual incorrect usages. So I think the change is worth it, and not much
> busywork. YMMV.
>
> What do you think?
I'm wondering how often in practice .ptr is not null but the array is empty.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list