From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2925b133078d1557 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Flexible Strings (was Equality operator...) Date: 1997/05/07 Message-ID: #1/1 X-Deja-AN: 240170665 References: <9704301422.AA07755@most> <5kocg6$hln@bcrkh13.bnr.ca> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-05-07T00:00:00+00:00 List-Id: <> That's a misconception. The above statement is one of intent, but it has no semantic force, because it would be impossible to specify the conditions under which storage could be reused. For example if the total heap size is 2N words, and we allocate two blocks of N and then free them, then can we allocate a single 2N word block -- the C standard is silent on this, and indeed has to be. So the above paragraph is not "firmly" saying anything. An implementation that ignores free is formally conformant. It would take the attitude that the storage is indeed made available for further allocation, but unfortunately none of your subsequent requests were able to be filled using this storage. Of course a C compiler that abused this too much would be useless and no one would use it, just as an Ada compiler that ignored unchecked deallocation would also be useless. Note that the Ada RM does indeed say: 17 For a standard storage pool, Free should actually reclaim the storage. which has just as much force from a formal point of view as the statementin the C standard. In the Ada RM it is Implementation Advice, which is much more honest. In the C standard it is also implementation advice, but it is less obvious that this is the case, as we seel from Kaz's post. It is a very common misconception for those without experience in what semantic definition is about, and what as-if semantics are about, to want to put statements like this into a language definition, but it is misleading and confusing. However, there is usually enough vocal support for such semantic nonsense that it creeps in from time to time in any language standard (the Ada RM is not without its examples of this kind of thing!) Actually I think the Implementation Advice sections in the RM are very helpful, because, since they are non-normative, you can use rather informal ("you know what I mean") kind of language, and say things that you could not say at all in normative text.