c++ - Integer casting in big-endian -


in big-endian machine, if have long variable , cast char, language specification guarantees least significant bits after cast?

in other words:

long = 50; char b = (char)a; assert(b == 50); /* true? */ 

i know true little-endian machines, big-endian?

...the value unchanged if can represented in destination type (and bit-field width); otherwise, value implementation-defined. (§4.7/3).

since char must able accommodate values @ least 127, result in case must 50.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -