On 5/31/07, Fred Cisin <cisin at xenosoft.com>
wrote:
The major advantage of Aztec (Manx) C was to be
able to run essentially
the same compiler on multiple microcomputer platforms. That was
especially useful, since before "ANSI C", there were lots of "minor"
variations from one K&R C to another.... I AM NOT asking what
"should be", I'm talking about comparing what compiler authors thought.
One that varies from platform to platform:
What does "char *p = NULL; return(strlen(p));" do?
On some machines, it returns 0. On others, it segfaults because you
asked it to dereference a null pointer. Both are "correct" behavior
because the official behavior is "undefined".
Ran into that one when someone tried to port some code from an NCR box
to a Sun box (yes, 10 years ago ;-) It worked "fine" on the NCR box,
but when it "broke" on the Sun, some of the NCR guys tried to claim it
was proof that NCRs were better than Suns (what, because it won't let
you slide by when you depend on undefined behavior behaving in a
particular way?)
I don't actually think the C standard specifies a behavior for this. I
can also tell you that even nowadays AIX will cheerfully permit you to
dereference a null pointer.
Steve
--