Public outcry against new .init behaviour

Deewiant deewiant.doesnotlike.spam at gmail.com
Mon Jul 2 20:59:48 PDT 2007


kris wrote:
> Seems like there's more subtlety to this than Walter has explained? From
> the description of the change, I'd asserted that the following code
> would be impacted:
> 
> # typedef int socket_t = -1;
> # ...
> # socket_t sock;
> # ...
> # if (sock is sock.init)
> # ...
> 
> However, upon inspection, the codegen for v1.017 is actually this:
> 
> # if (sock is sock.init)
> # 004044E6 83 7D 08 FF cmp dword ptr [sock],0FFh
> 
> meaning that the typedef value has been respected, just like v0.016
> 
> Either this means that Walter missed typedef in his changes, or that
> typedef is intended to remain as it was.
> 
> Which is it?
> 

If you change that code to "socket_t sock = 0;" then you'll see the difference.
Pre-1.017 would have compared to 0, now it always compares to -1.

-- 
Remove ".doesnotlike.spam" from the mail address.



More information about the Digitalmars-d mailing list