www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How does this work ?

reply Somedude <lovelydear mailmetrash.com> writes:
I'm going through a number of bug reports, trying to reproduce the
problems and see what can be closed easily (i.e non reproduced, correct
behaviour, etc), and I just came accross
http://d.puremagic.com/issues/show_bug.cgi?id=7326 titled
"write interprets enum with byte backing type as a character"

Here is the case description:

import std.stdio;

enum X : byte
{
    Foobar = 65,
}

void main()
{
    X x;
    writeln(x);  // writes 'A'
    writeln(cast(byte)x);  // writes 65
}

----------------

That's it.
When I run this on Win32, I get:
Foo
65

Can anyone explain me if it is the correct behaviour, and if yes, why ?
Thx.
Apr 19 2012
parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 4/19/12, Somedude <lovelydear mailmetrash.com> wrote:
 Can anyone explain me if it is the correct behaviour, and if yes, why ?
It's fixed now and we can close this down. I think it was related to formatting issues, that's all.
Apr 19 2012