Thoughts on some code breakage with 2.074

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Wed May 10 23:29:15 PDT 2017


On Wednesday, May 10, 2017 12:06:40 Ali Çehreli via Digitalmars-d wrote:
> On 05/10/2017 11:49 AM, Jonathan M Davis via Digitalmars-d wrote:
>  > On Wednesday, May 10, 2017 05:05:59 Ali Çehreli via Digitalmars-d 
wrote:
>  >> On 05/09/2017 10:34 AM, H. S. Teoh via Digitalmars-d wrote:
>  >>  > After upgrading the compiler, I get a warning that using a
>
> pointer as a
>
>  >>  > condition is deprecated.
>  >
>  > I think that that's the one that Andrei and Vladimir didn't like,
>  > because
>  > they actually used the conversion to bool correctly in their code a
>  > bunch
>  > (whereas most everyone else thought that it was too error prone), and
>  > the
>  > deprecation ended up being removed.
>  >
>  > - Jonathan M Davis
>
> Bummer for H. S. Teoh I guess... :/
>
> Although I prefer explicit over implicit in most cases, I've never
> graduated from if(p) and still using it happily. :)

The big problems is dynamic arrays, not pointers, which was what I thought
that H. S. Teoh was talking about (apparently, I read over what he said too
quickly). I don't know about deprecations with pointers and if statements,
and I use pointers sparingly enough in D that I don't know how long it would
be before I'd notice if it _were_ deprecated. But with dynamic arrays, it
checks for null, not for empty, and a bunch of folks tend to assume that it
checks for empty. Using dynamic arrays directly in if conditions is what had
been deprecated (on the theory that it was too error-prone) and what Andrei
and Vladimir were unhappy about.

- Jonathan M Davis




More information about the Digitalmars-d mailing list