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


Groups > comp.lang.c > #379495

Re: Call to a function

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: Call to a function
Date 2023-11-09 17:12 -0800
Organization A noiseless patient Spider
Message-ID <86msvmza11.fsf@linuxsc.com> (permalink)
References (3 earlier) <86jzs3de3h.fsf@linuxsc.com> <87h6n7tkv4.fsf@nosuchdomain.example.com> <86ttqf2w6p.fsf@linuxsc.com> <uha85r$ha56$1@dont-email.me> <uhm1sh$3va36$1@dont-email.me>

Show all headers | View raw


James Kuyper <jameskuyper@alumni.caltech.edu> writes:

> On 2023-10-29, Tim Rentsch wrote:
>
>> James Kuyper <james...@alumni.caltech.edu> writes:
>>
>>> On 10/24/23 8:54 PM, Tim Rentsch wrote:
>>>
>>>> Keith Thompson <Keith.S.T...@gmail.com> writes:
>
> ...
>
>>>>> Concretely, I believe that this program violates no syntax
>>>>> error or constraint.  It includes code whose behavior would be
>>>>> undefined if it were executed, but the `if (0)` prevents that.
>>>>>
>>>>> On what basis do you think a conforming implementation may
>>>>> reject it?
>>>>
>>>> First let me ask a question.  Does the C standard allow an
>>>> implementation to reject any program that is not strictly
>>>> conforming?
>>>
>>> [...]
>>>
>>> The standard never talks about rejection.  It requires that "A
>>> conforming hosted implementation shall accept any strictly
>>> conforming program.".  No such requirement applies to any program
>>> which is not strictly conforming.  (4p6)
>>
>> Perhaps I shouldn't have used the word "reject".  If the question
>> were phrased "Does the C standard allow an implementation not to
>> accept any program that is not strictly conforming?", does your
>> comment above mean you would say Yes to that question?
>
> As I said.  and you quoted above, "No such requirement applies to
> any program which is not strictly conforming".  That means that
> "there is no requirement to accept" or in other words "it is
> allowed to not accept", or in other words "it is allowed to
> reject".  How could I have reworded that comment to render it
> unnecessary for you to ask the above question,

Give a direct answer:  "I believe the intent of the C standard
allows an implementation not to accept any program that is not
strictly conforming.  (When you say reject I'm assuming you
mean the opposite of accept.)"  Just those two sentences, and
nothing more.

> and why would such re-wording have been necessary?

First, because I wasn't sure after reading your long answer
whether you might have been trying to make some subtle
distinction between the question I asked and the answer you were
giving.

Second, the purpose of posing the question I asked was to make
sure there is consensus on the threshold question.  I think it's
important to focus on this issue while it is still being debated.
I expect you have observed that of the four people responding, two
have agreed (you and Kaz) and two have not agreed (Richard Damon
and Keith Thompson).  I posted a followup question in response to
Richard's answer, but he has not yet replied.  Keith's comments
have been the most emphatic in disagreeing, and I think it would
help to discuss the threshold question separately before we get to
the larger question, so the discussion doesn't get too confused.

Third, considering the two previous points, giving a short direct
answer as outlined above is important to eliminate the need for me
to respond and try to narrow the focus to just the threshold
question.  I know the larger issue is important to you, and we
should get back to it, but I ask this question first because it's
important to what I have to say later.  Trying to take two steps
at a time often leads to confusion, especially in the context of a
discussion in comp.lang.c.

> The key point is that the code in question is strictly conforming,
> and a implementation therefore IS required to accept it.

Before I explain why that isn't so I really think it would help to
make sure everyone is on the same page with respect to the threshold
question, because if someone doesn't agree that the standard allows
a conforming implementation to reject any program that isn't
strictly conforming there is no point trying to explain to them
further.

> You earlier claimed "Every implementation is within its rights to
> reject any program whose static text includes[*] a cast from a
> pointer to an object type to a pointer to function type,
> regardless of whether the cast has any chance of being executed."
> Since ensuring that such code might not get executed is sufficient
> to make the program strictly conforming (DR 109), and this code
> guarantees that it won't be executed, how can an implementation be
> within it's rights to reject it?

Your reasoning is fine as far as it goes, but it's incomplete.  I
still would like to reach a shared understanding about the threshold
question.  I just posted a reply earlier today to two of Keith's
postings on this, let's give him a chance to respond before going
further.

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


Thread

Re: Call to a function James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-29 12:39 -0400
  Re: Call to a function Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-11-09 17:12 -0800

csiph-web