Skip to contentSkip to conversation

2.2.18 signal.h

DISCUSSION Jesse Pollard 2 participants 2 messages Dec 15, 2000

lore
Share & tools
lore
#0 lore raw

--------- Received message begins Here ---------

Quoted 24 lines

From: Andrea Arcangeli <[email protected]>

Quoted 14 lines · Ulrich Drepper
Quoted 12 lines · Andrea Arcangeli

x()
{

	switch (1) {
	case 0:
	case 1:
	case 2:
	case 3:
	;
	}
}
Quoted 7 lines
Quoted 3 lines

Why am I required to put a `;' only in the last case and not in all the previous ones? Or maybe gcc-latest is forgetting to complain about the previous ones ;)

Your C language knowledge seems to have holes. It must be possible to have more than one label for a statement. Look through the kernel sources, there are definitely cases where this is needed.

Quoted 5 lines

I don't understand what you're talking about. Who ever talked about "more than one label"?

The only issue here is having 1 random label at the end of a compound statement. Nothing else.

The label must be on an expression. Until the ";" is present to indicate a null expression it is syntacticly incorrect to have

switch (x) {
1:
2: something;
3:
}

The "3:" needs an expression to satisfy the syntax of "switch".

Quoted 10 lines

And yes I can see that the whole point of the change is that they want to also forbids this:

x()

{
	goto out;

out:
}

and I dislike not being allowed to do the above as well infact ;).

I think this has the same requirement. A null expression, specified with the ";" is a small price to pay for simplifying the error detection.

-------------------------------------------------------------------------
Jesse I Pollard, II
Email: [email protected]

Any opinions expressed are solely my own.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 2 lines · Jesse Pollard

[..] A null expression, specified with
the ";" is a small price to pay for simplifying the error detection. [..]

I'm not convinced this is a significant simplification (also considering the "hard" way is just working fine). I think it's only to be compliant with the standard and despite me not liking having to duplicate even more information in the sources, that's a good thing.

Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/