Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

constraint violation

91 views
Skip to first unread message

Bill Cunningham

unread,
Apr 30, 2014, 6:25:16 PM4/30/14
to
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

unread,
Apr 30, 2014, 7:14:44 PM4/30/14
to
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) ks...@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

unread,
Apr 30, 2014, 7:48:53 PM4/30/14
to

"Keith Thompson" <ks...@mib.org> wrote in message
news:ln38guo...@nuthaus.mib.org...
> "Bill Cunningham" <nos...@nspam.invalid> writes:
>> 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

unread,
Apr 30, 2014, 9:24:45 PM4/30/14
to
On 2014-04-30, Keith Thompson <ks...@mib.org> wrote:
> "Bill Cunningham" <nos...@nspam.invalid> writes:
>> 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

unread,
Apr 30, 2014, 10:11:42 PM4/30/14
to

"Kaz Kylheku" <k...@kylheku.com> wrote in message

> 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

unread,
Apr 30, 2014, 10:25:16 PM4/30/14
to

"Bill Cunningham" <nos...@nspam.invalid> wrote in message
news:ljsags$627$1...@dont-email.me...

> 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.


Ben Bacarisse

unread,
Apr 30, 2014, 10:36:38 PM4/30/14
to
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.

Bill Cunningham

unread,
Apr 30, 2014, 10:54:07 PM4/30/14
to

"Bill Cunningham" <nos...@nspam.invalid> wrote in message
news:ljsags$627$1...@dont-email.me...

>> 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?



Keith Thompson

unread,
May 1, 2014, 12:01:22 AM5/1/14
to
Kaz Kylheku <k...@kylheku.com> writes:
> On 2014-04-30, Keith Thompson <ks...@mib.org> wrote:
>> "Bill Cunningham" <nos...@nspam.invalid> writes:
>>> 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.

dS...@arcor.de

unread,
Oct 30, 2015, 10:30:12 AM10/30/15
to
Am Donnerstag, 1. Mai 2014 01:14:44 UTC+2 schrieb 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

unread,
Oct 30, 2015, 10:46:42 AM10/30/15
to
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.)

Kaz Kylheku

unread,
Oct 30, 2015, 11:12:36 AM10/30/15
to
"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.
0 new messages