Alan Balmer said:
Alan Balmer said:
On Tue, 18 Nov 2003 08:52:30 +0000, Christian Bau
[snip]
So the fact that memcpy (NULL, src, 1) produces undefined behavior in C
is not for some inherent reason, or for some deeply founded necessity,
it is because the people responsibly for the C Standard decided that it
would be so.
More likely because they decided that defining the behavior would have
little point, and would most likely break existing compilers, if not
code.
You said it. They *decided*. Definition 1b of 'decide' in m-w.com
goes:
"to select as a course of action"
However, deciding *whether* to define something is different than
deciding *which way* to define something. You need to read the rest of
the sentence as well.
Sure. But deciding *whether* to define something or leave it undefined
is still selecting a course of action.
So it is not the same as deciding *which way* to define something, but
it *is* the same as deciding *which way* to go about the definition.
Sure - they could have decided that a precise definition was needed.
They would then have to debate what that definition would be.
Correct, that decision would have required a subsequent decision,
while the decision of leaving the definition undecided did not.
No, they decided to leave the behavior undefined. That's the reason
for this discussion.
Depends which discussion - the OP asked whether some specific calls of
memcpy() had a defined behavior or not; later, some claimed that to
know the answer one has to read the ANSI standard, while others
claimed (or at least their statements were interpreted by more people
than myself alone as claiming) that common sense is enough.
With these parts of the thread in mind, let me assure you that I did
not disagree with your statement that "[they did not define the
behavior] [...] because they decided that defining the behavior would
have little point [...]".
However, I disagree with the implication (one that was not explicitly
stated by you, but from which this sub-thread originated) that it is
obvious that the actual decision of the Committee was to leave the
behavior undefined, only because the behavior would have little point.
I insist that one should read the Standard to know; it can't be
dismissed as obvious.
by LjL
(e-mail address removed)