Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #42400

Re: Does ANSI C allow free() to always be empty?

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Does ANSI C allow free() to always be empty?
Date 2014-03-31 11:18 -0400
Organization Self
Message-ID <53398728.8060303@verizon.net> (permalink)
References (1 earlier) <20ce79fa-cd1b-4f0b-9917-f68300602f80@googlegroups.com> <20140320201354.407@kylheku.com> <Je5Xu.3871$IN1.2467@en-nntp-15.dc1.easynews.com> <kfn8ursk3c3.fsf@x-alumni2.alumni.caltech.edu> <aiLZu.19517$S85.19010@en-nntp-16.dc1.easynews.com>

Show all headers | View raw


On 03/29/2014 10:27 PM, Richard Damon wrote:
> On 3/29/14, 7:11 PM, Tim Rentsch wrote:
...
>> An attorney arguing that point of view would have a significant
>> uphill battle.  Section 5.1.2.3 p6 spells out pretty clearly what
>> the bar is for being a conforming implementation, and it depends
>> only on externally observable behavior, not on any implementation
>> internal details.  Moreover if any member of the WG14 committee
>> were called to offer expert testimony in the case, I'm confident
>> their testimony would be that such questions are concerned only
>> with quality of implementation, and so are deliberately outside
>> of what the Standard considers in defining conformance.
>>
> 
> Actually, since that clause specifies that the output be correct
> according to what the abstract semantics would have produced, and the
> definition of free is to make the memory available for further
> allocations, this clause can NOT be used to excuse a reasonable reading
> to require free to at least attempt something.
> 
> As to being merely quality of implementations, most jurisdictions have
> laws that require products to have at least certain very minimal levels
> of quality to be offered.

A conforming implementation of C might might have quality so low that it
violates a particular jurisdiction's legal requirements for
merchantability; but that implementation could not be correctly
described as having falsely claimed to be a fully conforming.

> After all, would YOU allow someone to say the following is a C compiler:
> a shell script that checked if a file matches a specific sample, if it
> matches copy another file to a specified place, and if not print a message?
> 
> By a strict reading of the standard, such a script (with appropriate
> documentation) seems to meet all that the standard requires. After all,
> 5.2.4.1 only requires the ability to execute "at least one program ...",
> and may (because there is no other requirement) indicate that any other
> program for any reason doesn't meet the translation limits. There is a
> footnote (non-normative) to avoid fixed limits whenever possible, but
> that is 1) not normative, and 2) doesn't actually require anything.

Not quite: a #error directive that survives conditional compilation must
result in a diagnostic message that contains precisely specified
contents (6.10.5). Since conforming implementations are prohibited from
successfully translating such a translation unit (4p4), the fact that
they are only required to successfully translate and execute one program
does not exempt them from the requirements of 6.10.5.
Whether or not the #error directive survives conditional compilation,
and the exact text of that message, can only be determined with
certainty by implementing fully translation phases 1-4. In particular,
evaluation of #if conditions requires also implementing an extremely
limited subset of phase 7 processing.

Still, your basic point remains. Primarily due to 5.2.4.1, a minimally
conforming implementation of C can be far too minimal to be of any
practical use.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-08 22:08 -0800
  Re: Does ANSI C allow free() to always be empty? Kaz Kylheku <kaz@kylheku.com> - 2014-03-09 06:55 +0000
    Re: Does ANSI C allow free() to always be empty? David Brown <david.brown@hesbynett.no> - 2014-03-10 00:47 +0100
      Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-09 22:37 -0700
        Re: Does ANSI C allow free() to always be empty? David Brown <david.brown@hesbynett.no> - 2014-03-10 10:20 +0100
          Re: Does ANSI C allow free() to always be empty? Keith Thompson <kst-u@mib.org> - 2014-03-10 08:52 -0700
          Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-10 20:51 -0700
            Re: Does ANSI C allow free() to always be empty? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-11 01:08 -0500
            Re: Does ANSI C allow free() to always be empty? David Brown <david.brown@hesbynett.no> - 2014-03-11 12:52 +0100
              Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-12 00:09 -0700
                Re: Does ANSI C allow free() to always be empty? David Brown <david.brown@hesbynett.no> - 2014-03-12 12:59 +0100
      Re: Does ANSI C allow free() to always be empty? Kaz Kylheku <kaz@kylheku.com> - 2014-03-10 09:01 +0000
    Re: Does ANSI C allow free() to always be empty? Nick Bowler <nbowler@draconx.ca> - 2014-03-10 15:56 +0000
  Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-09 01:11 -0800
    Re: Does ANSI C allow free() to always be empty? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-09 12:39 +0000
      Re: Does ANSI C allow free() to always be empty? gazelle@shell.xmission.com (Kenny McCormack) - 2014-03-09 13:05 +0000
      Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-09 22:28 -0700
        Re: Does ANSI C allow free() to always be empty? Martin Shobe <martin.shobe@yahoo.com> - 2014-03-10 07:27 -0500
          Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-10 20:55 -0700
            Re: Does ANSI C allow free() to always be empty? Martin Shobe <martin.shobe@yahoo.com> - 2014-03-11 08:19 -0500
              Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-11 23:22 -0700
                Re: Does ANSI C allow free() to always be empty? Martin Shobe <martin.shobe@yahoo.com> - 2014-03-12 08:09 -0500
                Re: Does ANSI C allow free() to always be empty? James Kuyper <jameskuyper@verizon.net> - 2014-03-12 11:29 -0400
      Re: Does ANSI C allow free() to always be empty? Martin Shobe <martin.shobe@yahoo.com> - 2014-03-10 07:29 -0500
  Re: Does ANSI C allow free() to always be empty? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-09 09:14 +0000
    Re: Does ANSI C allow free() to always be empty? Robert Wessel <robertwessel2@yahoo.com> - 2014-03-10 15:33 -0500
  Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-09 23:05 -0700
    Re: Does ANSI C allow free() to always be empty? Martin Shobe <martin.shobe@yahoo.com> - 2014-03-10 07:43 -0500
      Re: Does ANSI C allow free() to always be empty? gordonb.3qcze@burditt.org (Gordon Burditt) - 2014-03-10 12:05 -0500
        Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-10 20:16 -0700
        Re: Does ANSI C allow free() to always be empty? Tim Rentsch <txr@alumni.caltech.edu> - 2014-03-29 16:27 -0700
      Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-10 21:48 -0700
        Re: Does ANSI C allow free() to always be empty? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-11 05:52 +0000
  Re: Does ANSI C allow free() to always be empty? partremmaps@gmail.com - 2014-03-20 19:14 -0700
    Re: Does ANSI C allow free() to always be empty? Kaz Kylheku <kaz@kylheku.com> - 2014-03-21 03:25 +0000
      Re: Does ANSI C allow free() to always be empty? Richard Damon <Richard@Damon-Family.org> - 2014-03-21 20:58 -0400
        Re: Does ANSI C allow free() to always be empty? Tim Rentsch <txr@alumni.caltech.edu> - 2014-03-29 16:11 -0700
          Re: Does ANSI C allow free() to always be empty? Richard Damon <Richard@Damon-Family.org> - 2014-03-29 22:27 -0400
            Re: Does ANSI C allow free() to always be empty? Tim Rentsch <txr@alumni.caltech.edu> - 2014-03-30 13:18 -0700
              Re: Does ANSI C allow free() to always be empty? Richard Damon <Richard@Damon-Family.org> - 2014-03-30 20:49 -0400
                Re: Does ANSI C allow free() to always be empty? Tim Rentsch <txr@alumni.caltech.edu> - 2014-04-17 10:52 -0700
            Re: Does ANSI C allow free() to always be empty? James Kuyper <jameskuyper@verizon.net> - 2014-03-31 11:18 -0400
    Re: Does ANSI C allow free() to always be empty? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-21 03:31 +0000
    Re: Does ANSI C allow free() to always be empty? Tim Rentsch <txr@alumni.caltech.edu> - 2014-03-29 15:39 -0700
      Re: Does ANSI C allow free() to always be empty? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-03-30 04:22 +0000

csiph-web