question about calling func( z, z++, z++ )

K

Keith Thompson

Phil Carmody said:
James Kuyper said:
Phil said:
[...]
Is func( z, z++, z++) a constraint violation?
No, but its behavior is undefined.

Yes, it indeed violates the contraints that guarantee definedness of
the behaviour.

Could you identify those constraints by section and paragraph?

Can you identify the section which indicates that it's UB?

Yes, C99 6.5p2.
 
K

Keith Thompson

Phil Carmody said:
Keith Thompson said:
Phil Carmody said:
[...]
Is func( z, z++, z++) a constraint violation?

No, but its behavior is undefined.

Yes, it indeed violates the contraints that guarantee definedness
of the behaviour.

"Constraint" has a specific meaning in C. func(z, z++, z++)
violates no constraint.

It also has a specific meaning in English.

If you left your Plaugher next to an electric heater - would it char?

Oh, I'm sorry, I thought you were trying to communicate in some
meaningful fashion.

As I said, the term "Constraint" has a very specific meaning in C.
If you're going to use that word, in a context where the C-specific
meaning is relevant, but with some different meaning, you should
make it clear that you're not using the C-specific meaning.

So what exactly was your point?
 
P

Phil Carmody

Keith Thompson said:
Phil Carmody said:
Keith Thompson said:
[...]
Is func( z, z++, z++) a constraint violation?

No, but its behavior is undefined.

Yes, it indeed violates the contraints that guarantee definedness
of the behaviour.

"Constraint" has a specific meaning in C. func(z, z++, z++)
violates no constraint.

It also has a specific meaning in English.

If you left your Plaugher next to an electric heater - would it char?

Oh, I'm sorry, I thought you were trying to communicate in some
meaningful fashion.

As I said, the term "Constraint" has a very specific meaning in C.
If you're going to use that word, in a context where the C-specific
meaning is relevant, but with some different meaning, you should
make it clear that you're not using the C-specific meaning.

So what exactly was your point?

I forget, you're probably used to a laugh track.

Phil
 
I

Ike Naar

Oh, I'm sorry, I thought you were trying to communicate in some
meaningful fashion.

As I said, the term "Constraint" has a very specific meaning in C.
If you're going to use that word, in a context where the C-specific
meaning is relevant, but with some different meaning, you should
make it clear that you're not using the C-specific meaning.

Phil was talking of "contraints", not "constraints" ;-)
 
P

Phil Carmody

Phil was talking of "contraints", not "constraints" ;-)

Typo aside, I guess I could have used a verb form instead. But that
would have been clumsier as it would separate the important words by
too much. It violates things which constrain defined behaviour.

Phil
 
J

James Kuyper

Phil said:
Keith Thompson said:
Phil Carmody said:
[...]
Is func( z, z++, z++) a constraint violation?
No, but its behavior is undefined.
Yes, it indeed violates the contraints that guarantee definedness
of the behaviour.
"Constraint" has a specific meaning in C. func(z, z++, z++)
violates no constraint.

It also has a specific meaning in English.

It's bad communications skills to use the ordinary English meaning of
the term, when writing in a context such as this newsgroup where a more
precise technical meaning of the term is (and should be) considered the
default. If you insist on doing so, you should flag the fact somehow.

However, that doesn't matter. Even by the ordinary meaning of the word,
you're misusing it. When the standard says that the behavior is
undefined, it's not a punishment for violating a rule, it's simply a
decision not to impose any requirements. Programmers are perfectly free
to write such code, and implementations are free to do whatever they
want to do with such code - which is precisely the problem. Undefined
behavior is not a constraint violation, it's the absence of constraints
(in the ordinary English meaning of the term) imposed by the standard on
the behavior of the program. The standard actually says "imposes no
requirements", but if you're going to insist on using words with their
fuzzy ordinary English meanings, then "requirements" comes close enough
for this purpose.
 
J

James Kuyper

Phil said:
....
too much. It violates things which constrain defined behaviour.

Which "things" does it violate? How do they constrain the defined behavior?
 
K

Keith Thompson

Phil Carmody said:
Keith Thompson said:
Phil Carmody said:
[...]
Is func( z, z++, z++) a constraint violation?

No, but its behavior is undefined.

Yes, it indeed violates the contraints that guarantee definedness
of the behaviour.

"Constraint" has a specific meaning in C. func(z, z++, z++)
violates no constraint.

It also has a specific meaning in English.

If you left your Plaugher next to an electric heater - would it char?

Oh, I'm sorry, I thought you were trying to communicate in some
meaningful fashion.

As I said, the term "Constraint" has a very specific meaning in C.
If you're going to use that word, in a context where the C-specific
meaning is relevant, but with some different meaning, you should
make it clear that you're not using the C-specific meaning.

So what exactly was your point?

I forget, you're probably used to a laugh track.

Ok, so it was a joke.

Humor isn't always as obvious in print as you might think it is,
and I'm not the only one who missed it. You might consider working
on your delivery.
 
P

Phil Carmody

James Kuyper said:
Which "things" does it violate? How do they constrain the defined behavior?

Your questions are actually a non-sequitur. If that level of subtlety
in the language is beyond you, then there's little point in continuing.

Phil
 
K

Keith Thompson

Phil Carmody said:
Your questions are actually a non-sequitur. If that level of subtlety
in the language is beyond you, then there's little point in continuing.

You tried to make a joke. It fell flat. Rather than insulting
the people who didn't realize you were joking, I suggest you drop
it and move on. If telling yourself that the joke was really funny
and the rest of us are idiots for not appreciating it helps you do
that, go right ahead.
 
J

jameskuyper

Phil said:
Your questions are actually a non-sequitur. If that level of subtlety
in the language is beyond you, then there's little point in continuing.

There's nothing subtle about what you said. I understand precisely
what it is that you intended to say, but said incorrectly. You're
simply misusing the language; and I agree that there's little point in
your continuing to misuse it in that fashion.
 
P

Phil Carmody

Keith Thompson said:
You tried to make a joke. It fell flat. Rather than insulting
the people who didn't realize you were joking, I suggest you drop
it and move on.

Which bit of "there's little point in continuing" are you failing to
understand?

Phil
 
K

Keith Thompson

Phil Carmody said:
Which bit of "there's little point in continuing" are you failing to
understand?

I agree that there's little point in continuing, but not for the
reasons you suggest. Feel free to have the last word if you like.
 
A

Antoninus Twink

ROTFLM : could you be a more reprehensible, obnoxious, nasty little big
head if you tried?

Do you get a thrill from being rude to people?

I think Carmodey is probably the single most unpleasant person posting
to this group - maybe even more than Mackintyre.

Heathfield may be arrogant and pompous and patronizing, but Carmodey is
an out and out psychopath.
 
A

Anand Hariharan

In Dread Ink, the Grave Hand of Keith Thompson Did Inscribe:


chad said:
I have some idea what a constraint violation is. However, I didn't
know it well enough to recognize if func( z, z++, z++ ) was or wasn't
a constraint violation. Hence why I had asked. [...]

Keep in mind that a constraint violation is something that must be
diagnosed at compile time.  A clever compiler *could* recognize that
func( z, z++, z++ ) violates the rules, but it would require analysis
of a kind that compilers are not generally required to perform.
Consider
    func( *p0, (*p1)++, (*p2)++ )
where p0, p1, and p2 are pointers.  If they all point to different
objects, this is fine.  If any two of them point to the same object,
the behavior is undefined, for exactly the same reason that the
behavior of
    func( z, z++, z++ )
is undefined.  Since the values of p0, p1, and p2 cannot in general be
known at compile time, the standard doesn't require the compiler to
recognize that there's a problem -- hence the behavior is undefined.

Chad and I seem to be persons who return to clc occasionally as
autodidacts.  I think I remember him.

There's no sequence point to be between the modifications of the object.

Keith, is it illegal to have a comma operator as any of the commas above?

As Keith already pointed out, the comma in "func( z, z++, z++ );" is
not a comma operator. What I wanted to add here is this: A comma
operator introduces a sequence point.

- Anand
 
K

Kenny McCormack

ROTFLM : could you be a more reprehensible, obnoxious, nasty little big
head if you tried?

This thread is a riot. Kiki's autism/Aspergers is certainly in fully
bloom and display here.

It does show one thing, though - that the regs do occasionally turn on
their own. Yet, I don't think Phil is full-blown reg yet, so I guess
he's fair game
Do you get a thrill from being rude to people?

Of course. That's the whole point of this NG.
 
K

Kenny McCormack

Keith Thompson <[email protected]> displayed her Aspergers-like personality
thusly:
....
You tried to make a joke. It fell flat. Rather than insulting
the people who didn't realize you were joking, I suggest you drop
it and move on. If telling yourself that the joke was really funny
and the rest of us are idiots for not appreciating it helps you do
that, go right ahead.

Aspergers on parade!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top