Why the value of 'ab\0\0' is 0x00616200, rather than 0x61620000 ?
The workset is win2k + VC6.
>
Any help would be appreciated.
The value of any character constant containing more than one character
is implementation-defined. You should consult the documentation for
your compiler. Better yet, you should avoid using such character
constants; they're extremely non-portable.
--
Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Why the value of 'ab\0\0' is 0x00616200, rather than 0x61620000 ?
The workset is win2k + VC6.
Because that's the value that the compiler you are using chose to give
it. The value of a character constant containing more than one
character is defined by the implementation. The algorithm they use is
supposed to be specified in the compiler's documentation. If you want
to know why they chose the algorithm they did, you'll have to ask the
maker of the compiler.
"Thomas Matthews" <Thomas_Hates_S pam@cox.network wrote in message
news:44DBF084.5 080501@cox.netw ork...
phoenix_keeper wrote:
Why the value of 'ab\0\0' is 0x00616200, rather than 0x61620000 ?
The workset is win2k + VC6.
Any help would be appreciated.
Thanks.
CJ
>
Research the term "Little Endian".
>
No...
Let's ignore for a moment the fact that it is a character constant and not a
string constant, as KT pointed out.
The last value in the OP's question: 0x61620000 is "Big Endian." But, the
first value(0x0061620 0) is _neither_ "Little Endian" (0x00006261) or "Big
Endian" (0x61620000) (as they are currently defined, i.e, no remarks on PDPs
please...). The fact that his value 0x00616200 has 'a' before 'b' and isn't
properly "Big Endian", indicates something else is going on (see KTs post).
Comment