cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <10vsrpo$men2$2@dont-email.me>, Bart <bc@freeuk.com> wrote:
On 04/06/2026 22:06, Keith Thompson wrote:
Bart <bc@freeuk.com> writes:
[snip]
Tim Rentsch I'm sure will prefer the latter because 99.9% of C
programmers are machines, according to him.
Tim didn't say or imply that.
So what was his 99.9% all about? Nobody has a clue, except they are
certain that what I think it is is wrong!
Have you thought about, I don't know, maybe asking him?
At the risk of saying what may be obvious to everyone, Bart has
shown that he has no interest in having a serious, constructive,
useful, or productive conversation with anyone. His questions
are all rhetorical; he hasn't asked me a straight question
because he isn't really interested in what I would say. In
short, Bart isn't looking for an answer, he's looking for an
argument. My recommendation is just stop responding to him
altogether. My response to him upthread was a sincere effort to
provide a neutral and helpful answer to his question. Maybe my
remarks were helpful to other people, and if they were that's
good. Any further efforts to interact with Bart are not just a
waste of time but actually counterproductive. What Bart needs is
not help with understanding C but a good therapist. In any case
I'm confident that whatever Bart's needs may be, no one responding
to his postings here is in a position to provide them. Please
consider these remarks before responding to him further.
On 04/06/2026 21:29, Bart wrote:
You're saying that:
How can this be /so/ difficult for you?
*-a "more than needed" is objective
No, I said that "(a*a) + (b*b)" has more parentheses than needed in the context of most programming languages" is objective.
*-a "too many" is subjective
No, I said that "(a*a) + (b*b) has too many parentheses" is subjective.
BC:Sadly the idea of writing in a way that is "most easily understood"
has resulted in a race to the bottom, where writers are more and
more encouraged to take the view that (some) readers are pretty
much arbitrarily stupid, with the result that expressions become
littered with scads of unnecessary parentheses that actually
detract from ease of reading. Good writing is always a balance
between too much and too little.
Actual examples of too many parentheses?
The point of my comment is that either too many or too few is a
subjective judgment, not an objective one.
My point was that it could be objective, at least for too many.
Tim Rentsch I'm sure will prefer the latter because 99.9% of C
programmers are machines, according to him.
Please give a reference for him saying that.-a (I'll save you the bother,
he has not made any remarks remotely like this in c.l.c. since I have
been here.)
Don't presume - you make a fool out of yourself every time you do.
Presumably, the same 99.9% will not use indentation, and will write
their programs all on one line anyway, because it is still after all
completely unambiguous according to the C standard!
James Kuyper <jameskuyper@alumni.caltech.edu> writes:
[...]
One advantage of having a single program do the whole thing, is
that error messages can mention the actual text of the line where
a problem was detected, without any pre-processing applied.
Typical preprocessors emit directives that tell the compiler
about the current file name and line number, precisely so that
diagnostic messages can refer to the original text.
For example:
$ cat hello.c
#include <stdio.h>
int main(void) {
printf("Hello world!\n");
}
$ gcc -E hello.c | tail
extern int __uflow (FILE *);
extern int __overflow (FILE *, int);
# 983 "/usr/include/stdio.h" 3 4
# 2 "hello.c" 2
# 2 "hello.c"
int main(void) {
printf("Hello world!\n");
}
$
The line `# 2 "hello.c"` is, according to the C standard, a
"non-directive", which is a kind of directive. Executing a
non-directive has undefined behavior,
On 6/4/2026 4:44 PM, Bart wrote:
On 05/06/2026 00:09, Keith Thompson wrote:
Bart <bc@freeuk.com> writes:
On 04/06/2026 22:06, Keith Thompson wrote:
Bart <bc@freeuk.com> writes:
On 04/06/2026 19:54, David Brown wrote:[...]
Stop it.-a He's not saying that.Again - /please/ stop trying to guess what people say or put words >>>>>>> in their mouths.-a I can't remember ever seeing you do so accurately. >>>>>>This is what you actually said:
It is an objective fact, therefore, that "(a*a) + (b*b)" has more >>>>>>> parentheses than needed in the context of most programming languages. >>>>>>>
"(a*a) + (b*b) has too many parentheses", on the other hand, is a >>>>>>> purely
subjective opinion.-a Even if it is true that this is "commonly agreed >>>>>>> to" (and AFAIK you have no basis for that claim), that would still >>>>>>> be a
subjective opinion - no matter how common that opinion is.
You're saying that:
*-a "more than needed" is objective
*-a "too many" is subjective
That is EXACTLY what he's saying: "It is an OBJECTIVE fact .. has more >>>> ... than needed", and:
-a "has too many ... is ... purely subjective".
You're taking phrases out of context and making false claims that the >>>>> full statement was far more general than it actually was.
And this is exactly what other people are doing.
Taken literally, your statement implies that you admit that that's
what you're doing.-a Is that what you meant?-a If so, I suggest you
*stop* making such false claims.-a If not, what did you actually mean?
So I used TOO MANY instead of MORE THAN NEEDED to describe the exact
same phenomenon.
That's not the problem.-a There is an actual meaningful distinction
here, between what's needed by the compiler and what's useful to
improve clarity for human readers.-a I have found some of what you've
written to be unclear about that distinction.
Can we agree that the question of whether parentheses in a C
expression are necessary to the compiler can be answered objectively?
Can we agree that the question of whether extra parentheses are
helpful to a human reader is at least partly subjective, and
varies from case to case?-a Is there really anything else that we
fundamentally disagree about?
(1) Why are you all making such a big fucking deal of this?
Why are you?
I didn't start this business of something being subjective or objective,
or suggesting than one turn of phrase to discuss the same thing was
subjective and the other objective (implying that a subjective opinion
had less worth). TR started that and several people backed him up.
Myself I wouldn't even use those terms. My point was that some overuses
of () for commonly known precedences are more overkill than others.
If that's subjective then so be it; it is not some fundamental law of
the universe. I would just call it common sense.
Why are you?
Since you ask, I was defending my point of view then got sidetracked by
this subjective/objective nonsense. I notice that TR has disappeared
from this subthread.
Wrt the number of ()'s? Might as well go to sleep with the following
song playing in the background:
(The Fate of Ophelia - Taylor Swift (Lyrics) Charlie Puth ft. Selena
Gomez, the weekd, ariana grande)
On 05/06/2026 08:29, David Brown wrote:
On 04/06/2026 21:29, Bart wrote:
You're saying that:
How can this be /so/ difficult for you?
*-a "more than needed" is objective
No, I said that "(a*a) + (b*b)" has more parentheses than needed in
the context of most programming languages" is objective.
*-a "too many" is subjective
No, I said that "(a*a) + (b*b) has too many parentheses" is subjective.
If anyone is interested (which I doubt; bart-bashing is much more fun),
this is the original context:
TR:
Sadly the idea of writing in a way that is "most easily understood"
has resulted in a race to the bottom, where writers are more and
more encouraged to take the view that (some) readers are pretty
much arbitrarily stupid, with the result that expressions become
littered with scads of unnecessary parentheses that actually
detract from ease of reading.-a Good writing is always a balance
between too much and too little.
BC:
Actual examples of too many parentheses?
TR:
The point of my comment is that either too many or too few is a
subjective judgment, not an objective one.
Here it is clear that 'too many' was just a paraphrase of 'unnecessary'.
Here is my followup to TR:
BC:
My point was that it could be objective, at least for too many.
For an infix syntax where * has higher priority than +, then it is a
fact that the () in (a*a) + (b*b) are not necessary.
So, assume a minimum number of () needed to properly parse an expression according to intent. Then:
(1) TOO FEW: necessarily has to be subjective. It suggests a desire for
more () than the minimum, but the exact number will vary.
(2) TOO MANY, MORE THAN NEEDED, ETC: These can objective if refering to
any number of extra () above the mininum. This is the point I made
above, the one I defended.
(3) TOO MANY, MORE THAN NEEDED, ETC: These can also be used in a
judgemental manner, and there are subjective. This is where a certain
number of extra () are accepted for readability etc, but the exact level will vary.
If this is the point people have been trying to make, then they've been doing it incredibly badly, and been unnecessarily unpleasant and insulting.
My own view is that C syntax has too much of (3), but necessarily so
because of the choices made in its operator levels.
Tim Rentsch I'm sure will prefer the latter because 99.9% of C
programmers are machines, according to him.
Please give a reference for him saying that.-a (I'll save you the
bother, he has not made any remarks remotely like this in c.l.c. since
I have been here.)
Find out what was the subject of the 99.9% (even if that was an exaggeration). Then we'll talk.
No, he didn't use the word 'machines'; I paraphrased to suggest
supernormal people who know everything and never make mistakes.
You're going to argue about this now?
Don't presume - you make a fool out of yourself every time you do.
Presumably, the same 99.9% will not use indentation, and will write
their programs all on one line anyway, because it is still after all
completely unambiguous according to the C standard!
And you proceed to do exactly the same; Bart must be wrong, but you
don't about what!
In article <1BoUR.3$lmCb.1@fx22.iad>, Scott Lurndal <slp53@pacbell.net> wrote: >>cross@spitfire.i.gajendra.net (Dan Cross) writes:<snip>
[snip]
Yeah, that's from `cc.c`, right?
No, it's from cpp.c
$ ls /work/reference/collegetapes/sltape/v6cc/
c0.c c00.c c01.c c02.c c03.c c04.c c05.c c1.h
c10.c c11.c c12.c c13.c c2.h c20.c c21.c cc.c cpp.c
Oh interesting. I don't have a `cpp.c` in my v6 archive.
I wonder what else I'm missing.
value = valp;}
On 05/06/2026 13:39, Bart wrote:
"a << (b + c)" has "more than needed" - that is objective.
"a << (b + c)" does not have "too many" in an objective sense, because
I cannot speak for the intentions of others, but it has certainly been
very frustrating trying to get you to understand the distinction between objective facts and subjective opinions,
Actual examples of too many parentheses?
The point of my comment is that either too many or too few is a
subjective judgment, not an objective one.
Sadly the idea of writing in a way that is "most easily understood"
has resulted in a race to the bottom, where writers are more and
more encouraged to take the view that (some) readers are pretty
much arbitrarily stupid, with the result that expressions become
littered with scads of unnecessary parentheses that actually
detract from ease of reading. Good writing is always a balance
between too much and too little.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:[...]
The line `# 2 "hello.c"` is, according to the C standard, a
"non-directive", which is a kind of directive. Executing a
non-directive has undefined behavior,
Since it is gcc that is generating the non-directives, for
internal purposes, and gcc that is consuming them, it hardly
seems worth worrying about whether their behavior is defined
or not.
On 05/06/2026 08:29, David Brown wrote:[...]
On 04/06/2026 21:29, Bart wrote:
TR:
BC:Sadly the idea of writing in a way that is "most easily understood"
has resulted in a race to the bottom, where writers are more and
more encouraged to take the view that (some) readers are pretty
much arbitrarily stupid, with the result that expressions become
littered with scads of unnecessary parentheses that actually
detract from ease of reading. Good writing is always a balance
between too much and too little.
TR:Actual examples of too many parentheses?
The point of my comment is that either too many or too few is a
subjective judgment, not an objective one.
Here it is clear that 'too many' was just a paraphrase of
'unnecessary'.
Tim Rentsch I'm sure will prefer the latter because 99.9% of C
programmers are machines, according to him.
Please give a reference for him saying that.-a (I'll save you the
bother, he has not made any remarks remotely like this in
c.l.c. since I have been here.)
Find out what was the subject of the 99.9% (even if that was an exaggeration). Then we'll talk.
No, he didn't use the word 'machines'; I paraphrased to suggest
supernormal people who know everything and never make mistakes.
You're going to argue about this now?
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Note that in a context that requires a constant expression, overflow is >>>> a constraint violation. For example, a case label like:
case (INT_MAX + 1) * 0:
must be diagnosed at compile time.
gcc disagrees with you.
What makes you think so?
[...]
I'm skipping this and proceeding on to the original question.
I see no basis for this belief. My conclusions are based on what
the C standard actually says, rather than guesses about some
unstated "intentions". I think you would do well to reach your
conclusions based more on the actual text of the C standard, and
less on your interpretation of what the text was "intended" to
mean.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[snip]
But taking a closer look at the standard, I'm not 100% sure that the
language requires a diagnostic, though I think that's the intent.
The relevant constraint is:
Each constant expression shall evaluate to a constant that is
in the range of representable values for its type.
If I squint really hard, I can argue that the entire expression
has to be a constant expression, but it doesn't say that its
subexpressions are constant expressions -- and *if* INT_MAX +
1 evaluates to INT_MIN in the current implementation, then
(INT_MAX + 1) * 0 evaluates to 0 and therefore satisfies the
constraint.
My reasoning is as follows.
To determine if the constraint is satisfied, the compiler must
first evaluate the expression (INT_MAX + 1) * 0.
To evaluate the expression (INT_MAX + 1) * 0, the compiler must
first evaluate the sub-expression (INT_MAX + 1).
Because the expression (INT_MAX + 1) overflows, the behavior is
undefined, and the compiler is free to decide that the value of
the sub-expression (INT_MAX + 1) is, let's say, 12.
The compiler next evaluates the overall expression as 12*0, which
is 0 (an int).
This result of the overall expression satisfies the constraint,
and so the compiler is not obliged to generate a diagnostic.
[snip]
I see no basis for this belief. My conclusions are based on what
the C standard actually says, rather than guesses about some
unstated "intentions". I think you would do well to reach your
conclusions based more on the actual text of the C standard, and
less on your interpretation of what the text was "intended" to
mean.
On 05/06/2026 08:53, Tim Rentsch wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <10vsrpo$men2$2@dont-email.me>, Bart <bc@freeuk.com> wrote:
On 04/06/2026 22:06, Keith Thompson wrote:
Bart <bc@freeuk.com> writes:
[snip]
Tim Rentsch I'm sure will prefer the latter because 99.9% of C
programmers are machines, according to him.
Tim didn't say or imply that.
So what was his 99.9% all about? Nobody has a clue, except they are
certain that what I think it is is wrong!
Have you thought about, I don't know, maybe asking him?
Asking him straight questions is usually futile. You can probably guess
this from the response below.
Notice he hasn't tried to enlighten anyone about that 99.9%.
That may just have been a throwaway line like when I say 'nobody likes
X', but I would still dispute that, if it's about what I think it is,
it's anything like a super-majority.
At the risk of saying what may be obvious to everyone, Bart has
shown that he has no interest in having a serious, constructive,
useful, or productive conversation with anyone. His questions
are all rhetorical; he hasn't asked me a straight question
because he isn't really interested in what I would say. In
short, Bart isn't looking for an answer, he's looking for an
argument. My recommendation is just stop responding to him
altogether. My response to him upthread was a sincere effort to
provide a neutral and helpful answer to his question. Maybe my
remarks were helpful to other people, and if they were that's
good. Any further efforts to interact with Bart are not just a
waste of time but actually counterproductive. What Bart needs is
not help with understanding C but a good therapist. In any case
I'm confident that whatever Bart's needs may be, no one responding
to his postings here is in a position to provide them. Please
consider these remarks before responding to him further.
I didn't read Bart's posting. Unfortunately it seems
true that any continued interaction with his comments
is counterproductive.
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <1BoUR.3$lmCb.1@fx22.iad>, Scott Lurndal <slp53@pacbell.net> wrote:<snip>
cross@spitfire.i.gajendra.net (Dan Cross) writes:
[snip]
Yeah, that's from `cc.c`, right?
No, it's from cpp.c
$ ls /work/reference/collegetapes/sltape/v6cc/
c0.c c00.c c01.c c02.c c03.c c04.c c05.c c1.h
c10.c c11.c c12.c c13.c c2.h c20.c c21.c cc.c cpp.c
Oh interesting. I don't have a `cpp.c` in my v6 archive.
I wonder what else I'm missing.
[snip]
In article <10vu703$11s5q$1@dont-email.me>, Bart <bc@freeuk.com> wrote:
On 05/06/2026 08:53, Tim Rentsch wrote:[...]
[...][...]
Generally speaking, AFAIK, none of the regular posters here are
qualified mental health professionals; as such, we should all
avoid from making armchair psychological diagnoses, the
occasionally midly offcolor joke aside ("that's crazy!").
The text of the standard explicitly carves this out; or, rather,[...]
it attempts to. If the result of an expression is not
representable in the target type, _regardless of whether that's
due to UB or not_, a diagnostic is required.
In article <DHAUR.47540$0o1c.29921@fx08.iad>,
Scott Lurndal <slp53@pacbell.net> wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <1BoUR.3$lmCb.1@fx22.iad>, Scott Lurndal <slp53@pacbell.net> wrote:<snip>
cross@spitfire.i.gajendra.net (Dan Cross) writes:
[snip]
Yeah, that's from `cc.c`, right?
No, it's from cpp.c
$ ls /work/reference/collegetapes/sltape/v6cc/
c0.c c00.c c01.c c02.c c03.c c04.c c05.c c1.h
c10.c c11.c c12.c c13.c c2.h c20.c c21.c cc.c cpp.c
Oh interesting. I don't have a `cpp.c` in my v6 archive.
I wonder what else I'm missing.
[snip]
Thanks! This is an artifact definitely worth preserving. As
far as I know, it's not in any of the extant V6 archives. I'll
shoot you an email, if that's ok.
On 31/05/2026 19:11, Bart wrote:...
Actual examples of too many parentheses?
Any source code written in LISP :-)
(And for too few parentheses, any source code in Forth.)
[...]
The text of the standard explicitly carves this out; or, rather,[...]
it attempts to. If the result of an expression is not
representable in the target type, _regardless of whether that's
due to UB or not_, a diagnostic is required.
How would an expression (appearing in a context that requires an
integer constant expression) not "evaluate to a constant that is in
the range of representable values for its type" other than by UB?
I can't think of an example, but I'd be interested in seeing one.
Note in particular that UINT_MAX+1U is well defined, not an overflow.
In article <1100gbk$1lt8i$2@kst.eternal-september.org>,
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:
[...]
The text of the standard explicitly carves this out; or, rather,[...]
it attempts to. If the result of an expression is not
representable in the target type, _regardless of whether that's
due to UB or not_, a diagnostic is required.
How would an expression (appearing in a context that requires an
integer constant expression) not "evaluate to a constant that is in
the range of representable values for its type" other than by UB?
It wouldn't. But because it's UB, it could evaluate to
anything, including something that didn't violate the
constraint.
I can't think of an example, but I'd be interested in seeing one.
In terms of a practical, working compiler? I doubt that one
exists.
In article <1100gbk$1lt8i$2@kst.eternal-september.org>,
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: >>>cross@spitfire.i.gajendra.net (Dan Cross) writes:
[...]
The text of the standard explicitly carves this out; or, rather,[...]
it attempts to. If the result of an expression is not
representable in the target type, _regardless of whether that's
due to UB or not_, a diagnostic is required.
How would an expression (appearing in a context that requires an
integer constant expression) not "evaluate to a constant that is in
the range of representable values for its type" other than by UB?
It wouldn't. But because it's UB, it could evaluate to
anything, including something that didn't violate the
constraint.
I can't think of an example, but I'd be interested in seeing one.
In terms of a practical, working compiler? I doubt that one
exists.
I actually meant in terms of the standard, not of any particular
compiler.
I can't think of an example, but maybe someone else can.
[...]
In article <86bjdpayv0.fsf@linuxsc.com>,
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[snip]
But taking a closer look at the standard, I'm not 100% sure that the
language requires a diagnostic, though I think that's the intent.
The relevant constraint is:
Each constant expression shall evaluate to a constant that is
in the range of representable values for its type.
If I squint really hard, I can argue that the entire expression
has to be a constant expression, but it doesn't say that its
subexpressions are constant expressions -- and *if* INT_MAX +
1 evaluates to INT_MIN in the current implementation, then
(INT_MAX + 1) * 0 evaluates to 0 and therefore satisfies the
constraint.
My reasoning is as follows.
To determine if the constraint is satisfied, the compiler must
first evaluate the expression (INT_MAX + 1) * 0.
To evaluate the expression (INT_MAX + 1) * 0, the compiler must
first evaluate the sub-expression (INT_MAX + 1).
Because the expression (INT_MAX + 1) overflows, the behavior is
undefined, and the compiler is free to decide that the value of
the sub-expression (INT_MAX + 1) is, let's say, 12.
The compiler next evaluates the overall expression as 12*0, which
is 0 (an int).
This result of the overall expression satisfies the constraint,
and so the compiler is not obliged to generate a diagnostic.
The text of the standard explicitly carves this out; or, rather,
it attempts to. If the result of an expression is not
representable in the target type, _regardless of whether that's
due to UB or not_, a diagnostic is required.
But as it happens, I think I can see how your interpretation may
be valid: if, as a result of UB, the expression evaluates to "0"
(or 12 or something simiilar) that _is_ representable, then
there _is no constraint violation_ and so no diagnostic is
required.
I do not believe that that is the intent. But it _is_
conformant with the text of the standard.
This is a problem with the C standard: it is insufficiently
precise, as the semantics of the language are not formally
defined.
[snip]
I see no basis for this belief. My conclusions are based on what
the C standard actually says, rather than guesses about some
unstated "intentions". I think you would do well to reach your
conclusions based more on the actual text of the C standard, and
less on your interpretation of what the text was "intended" to
mean.
The same could be said to you, as well. There exists a reading
of the standard by which your `foo`-containing program is not
strictly conforming .
But that way lies madness; C is not a
formally specified language. Given that as an objective fact,
we must accept intent, consistency, and other "soft" aspects
when considering its definition.
cross@spitfire.i.gajendra.net (Dan Cross) writes:
[snip]
But as it happens, I think I can see how your interpretation may
be valid: if, as a result of UB, the expression evaluates to "0"
(or 12 or something simiilar) that _is_ representable, then
there _is no constraint violation_ and so no diagnostic is
required.
Right. In fact the reasoning doesn't have to be so elaborate.
Just by looking at the types of the operands, a compiler can
determine the result is type int. Then, just by noticing the
multiplication by 0, a compiler could decide that the result is
zero, because the compiler is free to assume that there was no
undefined behavior in the left-hand side expression. Whether the
left-hand size expression has undefined behavior doesn't even have
to be checked to decide that (INT_MAX+1)*0 is 0, and so it can
satisfy the constraints of an integer constant expression.
I do not believe that that is the intent. But it _is_
conformant with the text of the standard.
I think your intuition is leading you astray. The people who
wrote the C standard have gone to great lengths to say (write)
what they mean and mean what they say (write). I don't see any
evidence to suggest that this property doesn't apply in the
situation being discussed.
This is a problem with the C standard: it is insufficiently
precise, as the semantics of the language are not formally
defined.
On the contrary, the C standard is quite precise:
when a program
construct is encountered that the Standard identifies as having
undefined behavior, the Standard IMPOSES NO REQUIREMENTS on what
behavior may result. That rule may not be what someone wants, but
there isn't any question about what is allowed, which is anything
at all.
[snip]
I see no basis for this belief. My conclusions are based on what
the C standard actually says, rather than guesses about some
unstated "intentions". I think you would do well to reach your
conclusions based more on the actual text of the C standard, and
less on your interpretation of what the text was "intended" to
mean.
The same could be said to you, as well. There exists a reading
of the standard by which your `foo`-containing program is not
strictly conforming .
The difference is my reading is based on what the C standard
actually says, and not on any guesses about "intent" or whether
the result "makes sense". When reading the C standard it's
important to develop the habit of reading the text as neutrally as
one can, and not inject any subconscious ideas about what it ought
to be saying.
But that way lies madness; C is not a
formally specified language. Given that as an objective fact,
we must accept intent, consistency, and other "soft" aspects
when considering its definition.
The C standard is not written in formal mathematical language, but
it is written in formal English.
Certainly there are places in
the standard where what is said does a poor job of conveying what
is expected. But the particular case of (INT_MAX+1)*0 is not one
of them.
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:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Note that in a context that requires a constant expression, overflow is >>>>> a constraint violation. For example, a case label like:
case (INT_MAX + 1) * 0:
must be diagnosed at compile time.
gcc disagrees with you.
What makes you think so?
[...]
I'm skipping this and proceeding on to the original question.
Why?
You made a statement, "gcc disagrees with you". I demonstrated,
in text that you snipped, that gcc does in fact agree with me.
You were wrong.
I don't know the basis of your error, so I asked.
Or maybe I'm missing something, and you had a valid point that I
didn't understand.
You're not required to answer my question, which I think was
an extremely reasonable one, but quoting it and then explicitly
refusing to answer it is pointlessly rude.
I'd like to know whether you still think you were right. If so,
I'd like to see your explanation. If not, an admission that you
made a mistake would be appreciated. But I expect neither from you.
[SNIP]
I see no basis for this belief. My conclusions are based on what
the C standard actually says, rather than guesses about some
unstated "intentions". I think you would do well to reach your
conclusions based more on the actual text of the C standard, and
less on your interpretation of what the text was "intended" to
mean.
The actual text of the standard implies that 42 is not an expression.
I rely on the obvious intent to conclude that it is.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
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:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Note that in a context that requires a constant expression, overflow is >>>>>> a constraint violation. For example, a case label like:
case (INT_MAX + 1) * 0:
must be diagnosed at compile time.
gcc disagrees with you.
What makes you think so?
[...]
I'm skipping this and proceeding on to the original question.
Why?
gcc is not authoritative.
I didn't want to get into an argument
about whether gcc is conforming, or which version of gcc was used,
or any similar distractions.
The C standard /is/ authoritative,
and I thought it would save time to cut to the chase.
[snip]
I'd like to know whether you still think you were right. If so,
I'd like to see your explanation. If not, an admission that you
made a mistake would be appreciated. But I expect neither from you.
I'd like to know why you ignored my explanation, based directly on
text from the C standard, about why an implementation is allowed to
process the code in question, without giving a diagnostic, and
still be conforming. An explanation that Dan Cross agreed with,
even if he may not like the consequences.
In investigating this question, I have run compilations using
multiple versions of gcc, on two different platforms. I have looked >carefully through the gcc man page. I have also run compilations
using multiple versions of clang, on two different platforms. After
doing all that, I ran compilations using godbolt, so I could check
the latest, or maybe almost latest, versions of gcc and clang. All
the different versions of gcc and clang that I have tried support my >hypothesis that gcc (and now also clang) interpret the C standard so
as to conclude that conforming to the C standard need not require a >diagnostic for situations like the code under discussion..
I'd like to ask you to do two things. First, read through the
reasoning given in my previous post, try to assess whether that
reasoning is sound, and post the results of yours contemplations.
Second, look again at the question of whether gcc (and also clang,
if you're up to it) support the hypothesis that a conforming
implementation need not give a diagnostic for code like that under >discussion. See if you can find a way of framing the question that
supports my statement, rather than simply looking for one that
supports your preconceived ideas. Post the results of your
investigations, both what other experiments you tried, and what your >assessment is of the results you got.
Do these two things and I will endeavor to explain my views on the
questions you have raised here, if such explanations are still
needed after your further examinations and comments.
[SNIP]
I see no basis for this belief. My conclusions are based on what
the C standard actually says, rather than guesses about some
unstated "intentions". I think you would do well to reach your
conclusions based more on the actual text of the C standard, and
less on your interpretation of what the text was "intended" to
mean.
The actual text of the standard implies that 42 is not an expression.
I rely on the obvious intent to conclude that it is.
Now it is you who is changing the subject. Besides not being on
point to the question being considered, it's a silly argument, and I
would hope you are smart enough to realize that. However, if you do
what I have asked in the previous paragraph, I can try to explain
why I think your views on this unrelated matter are wrongheaded.
My example is this:
constexpr int A = ~0U;
The type of the rhs is `int` and the value is not representable
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
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:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Note that in a context that requires a constant expression, overflow is >>>>>> a constraint violation. For example, a case label like:
case (INT_MAX + 1) * 0:
must be diagnosed at compile time.
gcc disagrees with you.
What makes you think so?
[...]
I'm skipping this and proceeding on to the original question.
Why?
gcc is not authoritative. I didn't want to get into an argument
about whether gcc is conforming, or which version of gcc was used,
or any similar distractions. The C standard /is/ authoritative,
and I thought it would save time to cut to the chase.
You made a statement, "gcc disagrees with you". I demonstrated,
in text that you snipped, that gcc does in fact agree with me.
No, you didn't.
You were wrong.
No, I wasn't. Your testing was faulty.
I don't know the basis of your error, so I asked.
Or maybe I'm missing something, and you had a valid point that I
didn't understand.
I'm offended that you think I have an obligation to remedy your
habit of lazy thinking, especially when as here the answer was
staring you right in the face, and you simply ignored it.
You're not required to answer my question, which I think was
an extremely reasonable one, but quoting it and then explicitly
refusing to answer it is pointlessly rude.
I wasn't refusing to answer. What I was doing was trying to
answer the original question, and answer it in a way that wouldn't
get lost in pointless bickering. Silly me.
I'd like to know whether you still think you were right. If so,
I'd like to see your explanation. If not, an admission that you
made a mistake would be appreciated. But I expect neither from you.
I'd like to know why you ignored my explanation, based directly on
text from the C standard, about why an implementation is allowed to
process the code in question, without giving a diagnostic, and
still be conforming. An explanation that Dan Cross agreed with,
even if he may not like the consequences.
In investigating this question, I have run compilations using
multiple versions of gcc, on two different platforms. I have looked carefully through the gcc man page. I have also run compilations
using multiple versions of clang, on two different platforms. After
doing all that, I ran compilations using godbolt, so I could check
the latest, or maybe almost latest, versions of gcc and clang. All
the different versions of gcc and clang that I have tried support my hypothesis that gcc (and now also clang) interpret the C standard so
as to conclude that conforming to the C standard need not require a diagnostic for situations like the code under discussion..
I'd like to ask you to do two things. First, read through the
reasoning given in my previous post, try to assess whether that
reasoning is sound, and post the results of yours contemplations.
Second, look again at the question of whether gcc (and also clang,
if you're up to it) support the hypothesis that a conforming
implementation need not give a diagnostic for code like that under discussion. See if you can find a way of framing the question that
supports my statement, rather than simply looking for one that
supports your preconceived ideas. Post the results of your
investigations, both what other experiments you tried, and what your assessment is of the results you got.
Do these two things and I will endeavor to explain my views on the
questions you have raised here, if such explanations are still
needed after your further examinations and comments.
[SNIP]
I see no basis for this belief. My conclusions are based on what
the C standard actually says, rather than guesses about some
unstated "intentions". I think you would do well to reach your
conclusions based more on the actual text of the C standard, and
less on your interpretation of what the text was "intended" to
mean.
The actual text of the standard implies that 42 is not an expression.
I rely on the obvious intent to conclude that it is.
Now it is you who is changing the subject. Besides not being on
point to the question being considered, it's a silly argument, and I
would hope you are smart enough to realize that. However, if you do
what I have asked in the previous paragraph, I can try to explain
why I think your views on this unrelated matter are wrongheaded.
In article <86y0gp82pd.fsf@linuxsc.com>,
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
I'd like to know why you ignored my explanation, based directly on
text from the C standard, about why an implementation is allowed to
process the code in question, without giving a diagnostic, and
still be conforming. An explanation that Dan Cross agreed with,
even if he may not like the consequences.
I am mystified as to why you are bringing my name into this, and
why you think "I may not like the consequences", or even what
that means. In any event, you are evidently laboring under some
assumption about what I think about this matter that is probably
incorrect.
But as it happens, I think I can see how your interpretation may
be valid: if, as a result of UB, the expression evaluates to "0"
(or 12 or something simiilar) that _is_ representable, then
there _is no constraint violation_ and so no diagnostic is
required.
I do not believe that that is the intent. But it _is_
conformant with the text of the standard.
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <86y0gp82pd.fsf@linuxsc.com>,
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
[...]
I'd like to know why you ignored my explanation, based directly on
text from the C standard, about why an implementation is allowed to
process the code in question, without giving a diagnostic, and
still be conforming. An explanation that Dan Cross agreed with,
even if he may not like the consequences.
I am mystified as to why you are bringing my name into this, and
why you think "I may not like the consequences", or even what
that means. In any event, you are evidently laboring under some
assumption about what I think about this matter that is probably
incorrect.
In a response to another posting of mine, you wrote this:
But as it happens, I think I can see how your interpretation may
be valid: if, as a result of UB, the expression evaluates to "0"
(or 12 or something simiilar) that _is_ representable, then
there _is no constraint violation_ and so no diagnostic is
required.
I do not believe that that is the intent. But it _is_
conformant with the text of the standard.
I based my statement that begins "An explanation that Dan Cross
agreed with, ..." on those two paragraphs.
[...]
Unfortunately, the C standard is simply not a precise, formal
document. This is well-known, and it's hardly C's fault: indeed
most of the applications of formalized descriptions of PL
semantics to practical programming languages postdates C's
invention; Dana Scott didn't introduce the term, "operational
semantics" until 1970, and it didn't start to make a serious
impact on languages until later.
[...]
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 70 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 37:38:42 |
| Calls: | 948 |
| Calls today: | 2 |
| Files: | 1,325 |
| Messages: | 280,462 |