[snips]
Show us where the standard says that an implementation in which storage
deallocated by free() is made available for further allocation by
another program invoked via the standard system() function would be
non-conforming.
I'll turn that around: where in the definition of, say, the pre-increment
operator as applied to a variable of type int, does it say that if the
variable's value before increment was 3 and the value after increment is
19,471, the implementation is non-conforming? Now try again, but for
values of 97 before and 65 after.
Right; there's no such definition. Doesn't exist. There's a reason for
this; it's pointless.
What matters is not that there is a clause for every possible case, but
that there is a rule, or set of rules, for determining what to expect.
There is; the standard goes to some length to differentiate between
defined, undefined, unspecified and implementation defined behaviours,
with the assumption the reader will apply those rules when determining
the implications of the rest of the document.
Thus, for example, one need not have a specific clause which disallows
the pre-increment operator to produce a result of 19,471 from a previous
value of 3; it is sufficient to have a definition of how pre-increment is
defined to work, plus the rules for determining what to expect: the
behaviour is defined _thus_, any implementation which does otherwise is
non-conforming.
Therefore, by defining a behaviour for free, the standard defines what
free is expected to do, how it is expected to behave. The up-front rules
about interpreting the behaviour do not need to expressly disallow the
case you mention, as the defined behaviour of free does not include such
a case *nor* does it include any allowance for implementation-defined
behaviour or the like; it behaves as documented, or the implementation
fails to meet the requirements of the standard and thus is non-conforming.
And what *is* the defined behaviour? Right - to make the memory
available for further allocation.
Ah, but wait. To *whom* does it define this behaviour? Is the C
standard suddenly the defining document for POSIX-based OSen? How about
non-POSIX-based OSen? How about process management in general? Cars?
Toaster ovens?
Nope, none of these apply. The behaviour defined is the contract between
implementation and developer, in the context of writing C programs to be
used in conjunction with a C implementation. That is *it*. No OSen, no
cars, no toaster ovens, just C, all C, nothing but C.
And what is the defined behaviour granted by the standard to the C
programmer using a conforming implementation? Right - that the memory is
made available for further allocation.
Not handed to the OS. Not handed to another process; the standard does
not define these things, in fact goes to some pains to avoid the whole
concept of these things. No, the context is the C program, and the
behaviour is clearly defined, without so much as an "implementation
defined" to even allow any other behaviour.
Where in the standard does it decree the case you mention is non-
conforming? In the definition of free, which defines the behaviour, and
the definition of the rules which determine whether an implementation is
conforming or not: if it fails to provide the defined behaviour, it is
non-conforming, the behaviour here is defined, the case cited involves
behaviour *other* than what is defined, voila; the implementation is non-
conforming.
Unless, that is, you can point out where, exactly, in the definition of
free it allows for an implementation-defined behaviour such as *not*
making the memory available for further allocation, as is required by the
wording.