Skip to content

Comment on Q: Why can I access an out-of-scope C++ var? A: So you rent a hotel room...parent

Comments

this one is an eye opener and very humble too http://stackoverflow.com/questions/2186595/c-is-there-a-diff...

edit: also thanks for making me spend probably next several hours reading through all that stuff :)

edit2: oooh this one is good as well http://stackoverflow.com/questions/3110154/why-is-the-explic...

edit3: Not from Eric but check out this C# code:

    sbyte[] foo = new sbyte[] { -1 };
    var x = foo as byte[];    // doesn't compile
    object bar = foo;
    var f = bar as byte[];    // succeeds
    var g = f[0];             // g = 255
edit4: oh and check out this description of c# compiler actions http://stackoverflow.com/questions/1917935/how-does-c-compil...

Is twos compliment behavior guaranteed in C#?

Yes, check out the Partition I 12.1 table 6 of ECMA-335 standard

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.