role of semicolon

M

Michael Mair

Merrill said:
I'm always glad when pete is the man who has the back of the man who needs
to use hemorrhoidal creme. These must have representations not linked to
integers. I threw away K&R2 today. MPJ

In reverse order:
Your loss.
' ', '\t', '\n', '\v', '\f'; pete forgot '\r' (carriage return); just
read K&R2 -- oh, too late.
I hereby award you the questionable order of the *PLONK*.

-Michael
 
C

CBFalconer

Merrill said:
Another nuance. What all belongs to whitespace char family?

Read the standard. Basically whatever the routines introduced by
ctype.h say. You can't be specific, because char sets vary.
 
P

pete

' ', '\t', '\n', '\v', '\f'; pete forgot '\r' (carriage return); just
read K&R2 -- oh, too late.

The description of isspace in the standard
gives all of the whitespace characters.

But, I had searched the rest of the standard first for "white space"
and found a couple of short lists.
 
M

Mike Wahler

Merrill & Michele said:
I'm always glad when pete is the man who has the back of the man who needs
to use hemorrhoidal creme. These must have representations not linked to
integers.

The values of all those characters are integers, their
exact values being implmentation-specific.

I threw away K&R2 today.

What a pity.

-Mike
 
M

Merrill & Michele

Joona I Palaste said:
I actually had a dream about you last night. Well, you didn't actually
appear in my dream. I was talking with other clc regulars (I don't
remember who) and we talked about you sometimes making sense and
sometimes not.
Are you one or two people? You name yourself as "Merrill & Michele" in
your posts. Is it Merrill or Michele who writes here?


I don't make a clear path through the exegetics. My real voice is
unverkennbar. You will decide for yourself how many persons I am when we
meet. We dream on the same see and sea the same tranquility of the moon.
Some day I shall have a cabin in your country where I shall play chess with
the great bear in the chornie nachee. MPJ
 
M

Merrill & Michele

Michael Mair said:
In reverse order:
Your loss.
' ', '\t', '\n', '\v', '\f'; pete forgot '\r' (carriage return); just
read K&R2 -- oh, too late.
I hereby award you the questionable order of the *PLONK*.

Please refrain from using poor English where I have to read it. How could
hemorrhoids be germane to c? Because I've been scratching my ass like
someone possessed for the last few weeks. You try, in polite conversation,
to use euphemisms with your snickering wife. Thus, semicolon. Hemorrhoids
was a joke but missing a semicolon gets you axed around me. Tschueß, jens.
 
K

Keith Thompson

Merrill & Michele said:
Please refrain from using poor English where I have to read it.
[...]

You've become boring. I don't use a killfile, but I will no longer
spend the considerable time and effort necessary to figure out what
you're talking about. If you post something topical and
understandable, I may respond. Otherwise, I give up on you.

Bye.
 
M

Merrill & Michele

Keith Thompson said:
Merrill & Michele said:
Please refrain from using poor English where I have to read it.
[...]

You've become boring. I don't use a killfile, but I will no longer
spend the considerable time and effort necessary to figure out what
you're talking about. If you post something topical and
understandable, I may respond. Otherwise, I give up on you.

Bye.

K&R2 is missing ; in the index. MPJ
 
L

Lawrence Kirby

"Lawrence Kirby"

Interestingly this is an example (and the only one) of when a compound
statement ISN'T a statement. Check the grammar.

[uses cordless keyboard+mouse for 1st time and wonders how he endured life
before]

I believe Mr. Kirby refers to a statement such as:
i = 6; ++j;
and calls this a compound statement.

I was just using the Standard's definition of a compound statement which
as others have said has the form { } enclosing a sequence of 0 or more
declarations and statements.

Lawrence
 
L

Lawrence Kirby

Actually, according to the grammar, it is a "compound-statement", but
it's not a "statement".

A "function-definition" consists of:

declaration-specifiers declarator declaration-list(opt) compound-statement

This is the only occurrence of "compound-statement" in the grammar
that's not a "statement".

Note that if the grammar required a "statement" here rather than a
"compound-statement", the following would be legal:

int foo(void)
return 42; /* not legal C */


More problematically

int foo(void);

would be a valid function definition because plain ; is a valid statement.
Instead, we have to write:

int foo(void)
{
return 42;
}
}
The claim that this "compound-statement" is not a "statement" is based
on a painfully literal reading of the grammar. If you want to argue
that a compound statement must be a statement (by the rules of ordinary
English grammar), I won't disagree too strongly.

I originally mentioned it as a curiosity. However forgetting the language
grammar for a second is it actually useful to think of a function body as
a statement? IMO there is too much incorrect baggage with that
association, just think of a function body as a function body and a
compound statement, which are correct.

Lawrence
 
L

Lawrence Kirby

Depends on which way you wish to go in the grammar.

However you do it there is no way using valid productions in the C grammar
for a statement non-terminal to be produced in the position if a function
body. It can only be a compound-statement.
A compound-statement
is a specific form of a statement (and has been so since the introduction
of the term in Algol 60). So, by all means, the function body is a
statement of particular form (and that was not the case in Algol 60).

No, it isn't a statement of a particular form. It has the same form as a
particular subclass of statement but that doesn't make it a statement.

Now that could be viewed as a defect in the standard if you expect the
semantics of C90 6.6/C99 6.8 (the clause defining a statement) to be
applied to an overall function body, because as it stands they are not. It
looks to me like C99 6.8 p2 and p3 should be moved to 6.8.2 because they
apply specifically to compound statements (you only get a sequence of
statements within a compound statement, and the term "block" specifically
relates to a compound statement).
In my opinion when Lawrence wrote that that particular compound-statement
was not a statement, he was wrong.

As far as the C standard is concerned I don't see any other way to
interpret it. Whether the C standard is defective in that respect (but
the fix I suggested doesn't make a function body a statement) and whether
it makes sense to consider a function body as a statement in more informal
discussion are different issues. My view on the second issue is mostly
"no", it creates more confusion than clarification.

Lawrence
 
L

Lawrence Kirby

Wait a moment. Is 42 an expression?

Good question. It can be but in, for example, the context of

enum { x = 42 };

it is a constant-expression, there is no "expression" language element
here, even though it has the correct form for an expression. Naturally we
would want to consider 42 and things like 40+2 as expressions for the
purposes of normal discussion even in contexts like this. Luckily we can
and be consistent with the standard because it defines the term
"expression" independently of the syntax non-terminal "expression". This
is not the case for "statement".
My reasoning is *not* based on the name, it is based on the production
rules. "statement" is the only production rule that produces
"compound-statement" without anything else. And that is why I say that
it is a particular form of a statement.

To do that you need to run productions forwards to create a
compound-statement and then backwards to derive a statement from that.
That is not a valid application of production rules.
Your point would have been
stronger when the syntax had been:
function-definition:
declaration-specifiers declarator declaration-list(opt)
function-body
function-body:
compound-statement

But that's a distinction that makes no difference.

Lawrence
 
M

Merrill & Michele

Lawrence Kirby said:
"Lawrence Kirby"
Alex Fraser wrote:
Part of the definition of main is the compound-statement, from the
'{'
to
the '}' inclusive. A compound-statement is a statement, so if you
count
that
too, then the answer is five.

Interestingly this is an example (and the only one) of when a compound
statement ISN'T a statement. Check the grammar.

[uses cordless keyboard+mouse for 1st time and wonders how he endured life
before]

I believe Mr. Kirby refers to a statement such as:
i = 6; ++j;
and calls this a compound statement.

I was just using the Standard's definition of a compound statement which
as others have said has the form { } enclosing a sequence of 0 or more
declarations and statements.

There was many things I didn't realize about the simple code I posted. MPJ
 
M

Merrill & Michele

The only thing I lost was you. Habe ich Dich verlegt oder verloren?
Please refrain from using poor English where I have to read it. How could
hemorrhoids be germane to c? Because I've been scratching my ass like
someone possessed for the last few weeks. You try, in polite conversation,
to use euphemisms with your snickering wife. Thus, semicolon. Hemorrhoids
was a joke but missing a semicolon gets you axed around me. Tschueß,
jens.

Now, seriously fellas, many among us lead other programmers. If you've got
someone working for you who can't seem to sit down and looks like he's got
an acetylene torch on his : , tell him it's not going to get better until he
shoves .h up his butt. It's a bridge that some of us haven't crossed
before.

BTW I hid my K&R at the Kneipe. Sorftiger Eingang. MPJ
 
K

Keith Thompson

Lawrence Kirby said:
Good question. It can be but in, for example, the context of

enum { x = 42 };

it is a constant-expression, there is no "expression" language element
here, even though it has the correct form for an expression. Naturally we
would want to consider 42 and things like 40+2 as expressions for the
purposes of normal discussion even in contexts like this. Luckily we can
and be consistent with the standard because it defines the term
"expression" independently of the syntax non-terminal "expression". This
is not the case for "statement".

Unfortunately, the standard's definition of "expression" is flawed.

C99 6.5p1 says:

An _expression_ is a sequence of operators and operands that
specifies computation of a value, or that designates an object or
a function, or that generates side effects, or that performs a
combination thereof.

Since the token sequence
42
contains no operators or operands, it doesn't strictly satisfy the
definition of "expression", though it's clearly the intent that it is
one, at least if it appears in an expression context.

This was discussed at length in comp.std.c a while ago in the "Is 5 an
expression?" thread. I suggest reviewing that thread before posting
on the subject here; it's very likely that whatever point you want to
make has already been made.
 
Z

Zax

Keith Thompson said:
Merrill & Michele said:
Please refrain from using poor English where I have to read it.
[...]

You've become boring. I don't use a killfile, but I will no longer
spend the considerable time and effort necessary to figure out what
you're talking about. If you post something topical and
understandable, I may respond. Otherwise, I give up on you.

Bye.

I disagree. Hello. Zax
 
M

Michael Mair

Zax said:
Please refrain from using poor English where I have to read it.

[...]

You've become boring. I don't use a killfile, but I will no longer
spend the considerable time and effort necessary to figure out what
you're talking about. If you post something topical and
understandable, I may respond. Otherwise, I give up on you.

Bye.

I disagree. Hello. Zax

Hello again MPJ,

and what exactly do you think to gain by this childish game?
Zax meets killfile.

-Michael
 
K

Keith Thompson

Zax said:
Keith Thompson said:
Merrill & Michele said:
Please refrain from using poor English where I have to read it.
[...]

You've become boring. I don't use a killfile, but I will no longer
spend the considerable time and effort necessary to figure out what
you're talking about. If you post something topical and
understandable, I may respond. Otherwise, I give up on you.

Bye.

I disagree. Hello. Zax

Judging from the article headers, I believe that "Merrill & Michele"
and "Zax" are the same person.

"Merrill & Michele", or whoever you are, you have gone beyond being
boring and become an actively obnoxious troll. Actually, you've been
a troll for a while, but I've tried to give you the benefit of the
doubt. Though I still prefer not to use a killfile, if I reply to
another of your articles it will be either to correct misinformation
for the benefit of others or to warn people about your behavior.
 

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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,278
Latest member
BuzzDefenderpro

Latest Threads

Top