|
![](/i/fill.gif) |
Thorsten Froehlich <tho### [at] trf de> wrote:
: Sorry, but you are misunderstanding the concepts here: You have to view the
: problem on a lower level than the C programming language. You have to look
: at the hardware: In case of a memory based CPU architecture, an access to a
: int casted to a char will have certain side effects that are usually
: "hidden" by a compiler, however, especially in the early days of C it was
: common to use the knowledge about the CPU the code would run on to increase
: speed.
I think that a C compiler making this kind of thing (ie. when '1' is casted
to a char, the value '0' results) breaks the ANSI C standard, and thus the
compiler is not an ANSI C one.
Of course you can use low-level tricks to, for example, get the endianess
of the system, but you can't do many of these tricks without breaking the
standard (usually the standard says about these things that they are undefined
and the compiler can do whatever it wants about them).
But as you said, specially in embedded systems this kind of freedom makes
C a very versatile language. Not many other languages allow you to, for
example, write directly to a memory location some value.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |