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


Groups > comp.lang.c > #379359 > unrolled thread

Re: Call to a function

Started byJames Kuyper <jameskuyper@alumni.caltech.edu>
First post2023-10-29 12:39 -0400
Last post2023-11-09 17:12 -0800
Articles 2 — 2 participants

Back to article view | Back to comp.lang.c

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#379359 — Re: Call to a function

FromJames Kuyper <jameskuyper@alumni.caltech.edu>
Date2023-10-29 12:39 -0400
SubjectRe: Call to a function
Message-ID<uhm1sh$3va36$1@dont-email.me>
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,
and why would such re-wording have been necessary?

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

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?

[toc] | [next] | [standalone]


#379495

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2023-11-09 17:12 -0800
Message-ID<86msvmza11.fsf@linuxsc.com>
In reply to#379359
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c


csiph-web