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


Groups > comp.lang.c > #161940

Re: #include <stdint.h>

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: #include <stdint.h>
Date 2021-07-16 12:31 -0700
Organization None to speak of
Message-ID <87a6mm2gzj.fsf@nosuchdomain.example.com> (permalink)
References (2 earlier) <86bl7vb24m.fsf@linuxsc.com> <874kdnw20s.fsf@nosuchdomain.example.com> <86sg0l6uza.fsf@linuxsc.com> <87mtqs5vre.fsf@nosuchdomain.example.com> <86h7gu7dki.fsf@linuxsc.com>

Show all headers | View raw


Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
[...]
>>> Basically the question boils down to what is meant by the
>>> somewhat vague phrase "the correct type".  I believe that phrase
>>> is meant to refer to the rules of 7.16.1.1.  If you want to say
>>> there's an ambiguity about what is meant, certainly I could agree
>>> with that.  For purposes of posting in comp.lang.c, my usual rule
>>> is to judge the language according to what meaning is intended,
>>> and since here we are in agreement about what is intended here we
>>> are not in conflict.  Whether the C standard "actually says" that
>>> the va_arg rules apply to *printf functions is, I think, not
>>> an answerable question, and in any case not really a useful
>>> question for purposes of comp.lang.c.  I am glad we agree about
>>> what rule is intended, and IMO that is really all that matters
>>> for the present discussion.
>>
>> I mostly agree, but I disagree with your statement about the va_arg
>> rules applying to *printf.
>>
>> The standard doesn't say that the *printf functions use va_arg.  The
>> question of whether the standard *actually says* that va_arg rules
>> apply to *printf functions is, I think, answerable, and the answer
>> is no.
>>
>> Whether that matters is another question, but surely a question
>> about whether the standard says something can be resolved by reading
>> the standard.
>
> I think you misunderstood what I was saying.  There is no
> question about what words are present.  What the words mean is
> another story.  In many cases if not most cases the meaning
> of sentences written in English is at least partly subjective.
> That is the case here.  To talk about what the words "actually
> say" is to talk about meaning, and here the meaning is
> ambiguous.  The phrase "the correct type" is not well-defined.
> In fact, since it has not been given an explicit definition,
> someone might conclude that a *printf format that needs any
> arguments at all will necessarily lead to undefined behavior.
> I think you want to ascribe some sort of objective meaning
> to the text, but the use of the undefined phrase "the correct
> type" makes that impossible.

I think it's not so much misunderstanding as disagreement.

You wrote:

    Whether the C standard "actually says" that the va_arg rules apply
    to *printf functions is, I think, not an answerable question, and in
    any case not really a useful question for purposes of comp.lang.c.

I simply disagree.  It is an answerable question, and the answer is no;
the standard does not say that anywhere.  It provides <stdarg.h> as *a*
mechanism for implementing variadic functions, and specifies the rules
that apply when va_arg is used, but it simply does not say that printf
is implemented using va_arg or that it follows the rules specified for
va_arg.  A footnote says "The macros defined in the <stdarg.h> header
(7.16) may be used to access arguments that correspond to the
ellipsis.", which clearly implies the possibility of other mechanisms.

If it said that, there would be words to that effect.  There
aren't.  (Of course I'm open to correction if I'm missed something.)

As for "the correct type", I suggest that that phrase is inconsistent
with there being more than one correct type.  The phrase "the correct
type" is not rigorously defined, but it is unambiguous that it refers to
one type.  int and unsigned int are two distinct types; it is not
possible that they can both qualify as "the correct type".  If it had
said "a correct type", that would leave open the possibility that either
int or unsigned int might be correct as an argument corresponding to
"%d", for example.

You see ambiguity in the words used in the standard that, as I read it,
just isn't there.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

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


Thread

#include <stdint.h> SIMON <invalid@invalid.invalid> - 2021-06-13 23:08 +0100
  Re: #include <stdint.h> Bart <bc@freeuk.com> - 2021-06-13 23:27 +0100
    Re: #include <stdint.h> Bart <bc@freeuk.com> - 2021-06-13 23:57 +0100
      Re: #include <stdint.h> Philipp Klaus Krause <pkk@spth.de> - 2021-06-14 09:03 +0200
        Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-14 01:23 -0700
          Re: #include <stdint.h> Philipp Klaus Krause <pkk@spth.de> - 2021-06-14 12:31 +0200
        Re: #include <stdint.h> Bart <bc@freeuk.com> - 2021-06-14 11:54 +0100
  Re: #include <stdint.h> James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-06-13 18:34 -0400
  Re: #include <stdint.h> Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-06-13 23:34 +0100
  Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-13 17:48 -0700
    Re: #include <stdint.h> Philipp Klaus Krause <pkk@spth.de> - 2021-06-14 09:09 +0200
      Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-14 01:24 -0700
        Re: #include <stdint.h> Philipp Klaus Krause <pkk@spth.de> - 2021-06-14 12:30 +0200
    Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-06-24 10:31 -0700
      Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-24 11:28 -0700
        Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-07-11 02:49 -0700
          Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-07-11 15:30 -0700
            Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-07-16 03:33 -0700
              Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-07-16 12:31 -0700
                Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-09-30 07:07 -0700
                Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-09-30 08:42 -0700
                Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-06 03:55 -0700
                Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-06 07:06 -0700
                Re: #include <stdint.h> James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-06 11:47 -0400
        Re: #include <stdint.h> Andrey Tarasevich <andreytarasevich@hotmail.com> - 2021-10-06 09:35 -0700
          Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-06 10:06 -0700
          Re: #include <stdint.h> James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-06 17:40 -0400
            Re: #include <stdint.h> Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-06 22:14 +0000
              Re: #include <stdint.h> James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-06 20:06 -0400
                Re: #include <stdint.h> Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-07 02:15 +0000
      Re: #include <stdint.h> Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-06-24 22:34 +0100
        Re: #include <stdint.h> Öö Tiib <ootiib@hot.ee> - 2021-06-24 15:01 -0700
          Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-24 15:26 -0700
        Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-07-11 02:14 -0700

csiph-web