Discussion:
constraint violation
(too old to reply)
Bill Cunningham
2014-04-30 22:25:16 UTC
Permalink
Raw Message
I read the standard and if I'm reading it right to be a constraint
violation there must be undefined behavior. What exactly is a constraint
violation? Specifically concerning strtol for example?

Bill
Keith Thompson
2014-04-30 23:14:44 UTC
Permalink
Raw Message
Post by Bill Cunningham
I read the standard and if I'm reading it right to be a constraint
violation there must be undefined behavior. What exactly is a constraint
violation? Specifically concerning strtol for example?
I think you have the cause and effect reversed.

If a C program violates either a syntax rule or a constraint, a
conforming compiler must issue a diagnostic. This can be either
a fatal error message (causing the compilation to fail) or a
non-fatal warning (possibly permitting the compilation to succeed).
See N1570 5.1.1.3.

(The only cases where a compiler *must* fail is when there's a #error
directive that's not removed by #if, #ifdef, et al.) See N1570 4p4.

Once a compiler detects a constraint violation and issues a
diagnostic, it's done its job as far as the standard is concerned.
*If* it goes on to generate an executable program, that program's
behavior is undefined. (This might be a slight oversimplification,
but not in any way worth worrying about.) Extensions can be
implemented this way.

All constraints are explicitly defined in the standard, in paragraphs
clearly marked "Constraints".

I'm ignoring your reference to strtol because it has no relevance
to the rest of your question.
--
Keith Thompson (The_Other_Keith) kst-***@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Bill Cunningham
2014-04-30 23:48:53 UTC
Permalink
Raw Message
Post by Keith Thompson
Post by Bill Cunningham
I read the standard and if I'm reading it right to be a constraint
violation there must be undefined behavior. What exactly is a constraint
violation? Specifically concerning strtol for example?
I think you have the cause and effect reversed.
If a C program violates either a syntax rule or a constraint, a
conforming compiler must issue a diagnostic. This can be either
a fatal error message (causing the compilation to fail) or a
non-fatal warning (possibly permitting the compilation to succeed).
See N1570 5.1.1.3.
[snip]

Thank you very much for your help. I will refer to that § of n1570.

B
Kaz Kylheku
2014-05-01 01:24:45 UTC
Permalink
Raw Message
Post by Keith Thompson
Post by Bill Cunningham
I read the standard and if I'm reading it right to be a constraint
violation there must be undefined behavior. What exactly is a constraint
violation? Specifically concerning strtol for example?
I think you have the cause and effect reversed.
Oh, I don't think so.

Billy has had the same people going for 11+ years now: he's an astute
manipulator of cause, in obtaining an effect.

The irony is it is those of *you* who respond who have the learning
disability---a confirmed real one.

You don't seem to be able to learn that "cunning ham" will never absorb
a single thing.

You keep responding the same way year after year to the same postings,
expecting different results: a popular definition of insanity, attributed
to A. Einstein.
Bill Cunningham
2014-05-01 02:11:42 UTC
Permalink
Raw Message
Post by Kaz Kylheku
Oh, I don't think so.
Billy has had the same people going for 11+ years now: he's an astute
manipulator of cause, in obtaining an effect.
The irony is it is those of *you* who respond who have the learning
disability---a confirmed real one.
You don't seem to be able to learn that "cunning ham" will never absorb
a single thing.
You keep responding the same way year after year to the same postings,
expecting different results: a popular definition of insanity, attributed
to A. Einstein.
You must be right. Remeber that. Otherwise *your* thinking is
irrational. Not mine. You need to learn how to properly reason before
thinking.
Bill Cunningham
2014-05-01 02:25:16 UTC
Permalink
Raw Message
Post by Bill Cunningham
You must be right. Remeber that. Otherwise *your* thinking is
irrational. Not mine. You need to learn how to properly reason before
thinking.
Tell me...What is it that you are expecting ? Reason that before you
make such a comment. And then you'll *know* the epistemic truth.
Bill Cunningham
2014-05-01 02:54:07 UTC
Permalink
Raw Message
Post by Kaz Kylheku
The irony is it is those of *you* who respond who have the learning
disability---a confirmed real one.
Learning disabililty? You're making things up now. Who ever said
anything in 11+ years about a "Learning Disability"? You need to get your
facts and propositions straight. You are assuming too much. How did you ever
get anywhere with C?
Ben Bacarisse
2014-05-01 02:36:38 UTC
Permalink
Raw Message
Post by Kaz Kylheku
Post by Keith Thompson
Post by Bill Cunningham
I read the standard and if I'm reading it right to be a constraint
violation there must be undefined behavior. What exactly is a constraint
violation? Specifically concerning strtol for example?
I think you have the cause and effect reversed.
Oh, I don't think so.
Billy has had the same people going for 11+ years now: he's an astute
manipulator of cause, in obtaining an effect.
The irony is it is those of *you* who respond who have the learning
disability---a confirmed real one.
You don't seem to be able to learn that "cunning ham" will never absorb
a single thing.
You keep responding the same way year after year to the same postings,
expecting different results: a popular definition of insanity, attributed
to A. Einstein.
It's a mistake to see Usenet as a conversation between individuals.
I've learnt a whole lot from answers to questions I did not ask. When I
reply to almost anyone, I decide if the reply itself might be useful. I
am often absolutely certain that it will be of no use to the person I am
replying to. Sometimes the value accrues to me when someone corrects my
reply.
--
Ben.
Keith Thompson
2014-05-01 04:01:22 UTC
Permalink
Raw Message
Post by Kaz Kylheku
Post by Keith Thompson
Post by Bill Cunningham
I read the standard and if I'm reading it right to be a constraint
violation there must be undefined behavior. What exactly is a constraint
violation? Specifically concerning strtol for example?
I think you have the cause and effect reversed.
Oh, I don't think so.
Billy has had the same people going for 11+ years now: he's an astute
manipulator of cause, in obtaining an effect.
[snip]

I'm aware of Bill Cunningham's history. In this case, I chose to
treat the question as a sincere one because I thought my answer
might provide useful information, whether it happens to be useful
to Bill or not.
--
Keith Thompson (The_Other_Keith) kst-***@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
d***@arcor.de
2015-10-30 14:30:03 UTC
Permalink
Raw Message
Post by Keith Thompson
All constraints are explicitly defined in the standard, in paragraphs
clearly marked "Constraints".
But consider for example N1570 **7.7 Characteristics of floating types <float.h>**
§2 _The macros, their meanings, and the constraints (or restrictions) on their values are listed in 5.2.4.2.2._
That suggests that **5.2.4.2.2** contains constraints, while there is no mention of the term *constraint* there.
--
Regards,
Dietmar Schindler
Keith Thompson
2015-10-30 14:46:40 UTC
Permalink
Raw Message
Post by d***@arcor.de
Post by Keith Thompson
All constraints are explicitly defined in the standard, in paragraphs
clearly marked "Constraints".
But consider for example N1570 **7.7 Characteristics of floating types
<float.h>** §2 _The macros, their meanings, and the constraints (or
restrictions) on their values are listed in 5.2.4.2.2._ That suggests
that **5.2.4.2.2** contains constraints, while there is no mention of
the term *constraint* there.
I think 7.7 is using the word "constraints" in its ordinary English
sense, not in the sense defined by the standard. (It probably
shouldn't.)
--
Keith Thompson (The_Other_Keith) kst-***@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Kaz Kylheku
2015-10-30 15:12:32 UTC
Permalink
Raw Message
Post by d***@arcor.de
Post by Keith Thompson
All constraints are explicitly defined in the standard, in paragraphs
clearly marked "Constraints".
But consider for example N1570 **7.7 Characteristics of floating types <float.h>**
§2 _The macros, their meanings, and the constraints (or restrictions) on
their values are listed in 5.2.4.2.2._
That suggests that **5.2.4.2.2** contains constraints, while there is no
mention of the term *constraint* there.
"Constraints" paragraphs indicate diagnosable semantic rules for
programs. They give a requirement, to implementors, to diagnose
certain situations.

These rules are called constraints because, picking up where syntax
leaves off, they further limit the set of token sequences that may be
considered well-formed translation units.

Constraints on the values of macros in <float.h> are apply to implementors.
They are constraints in a different sense.

Loading...