byte & byte

Jesse Phillips jessekphillips+D at gmail.com
Fri Oct 29 11:52:39 PDT 2010


Ellery Newcomer Wrote:

> On 10/29/2010 10:48 AM, Jesse Phillips wrote:
> > Because C code will not behave differently
> >
> 
> I'm not convinced of this. Proposed counterexample:
> 
> // test.d
> import std.stdio;
> void main(){
>    ushort x = 0xffff;
>    writefln("%08x", ~x+1u);
> }

http://ideone.com/OsbTE

> // test.c
> #include <stdio.h>
> void main(void){
>    unsigned short x = 0xffff;
>    printf("%08x", ~x+1u);
> }

http://ideone.com/4S4QO

Ok, truly not what I was thinking would happen. I believe D's behavior to be correct, but as it is the exact same code I think it is worthy of a bug report.


More information about the Digitalmars-d-learn mailing list