Liste des Groupes | Revenir à cl c |
On 04/12/2024 19:47, Janis Papanagnou wrote:- It's reasonable not to require a semicolon (which is a statement termination) to terminate a statement block, which is terminated by the closing brace. A semicolon would be redundant.On 04.12.2024 13:08, David Brown wrote:OK, if it's so simple, explain it to me.Sure. And it is certainly /possible/ to know all the small details of C>
without ever reading the standards. But it's quite unlikely.
The question is (IMO) not so much to know "all" and even "all small"
details. Even in a language like "C" (that I'd consider to be fairly
incoherent if compared to other languages' design) you can get all
"important" language properties (including details) from textbooks.
>
If cases where that is different, the standards documents - which
have their very own special way of being written - would be even
less comprehensibly as they (inherently) already are. - That said
from a programmer's POV (not from the language implementors').
>
I look into language standards only if I want to confirm/falsify
an implementation; in this case I'm taking the role of a language
implementor (not a programmer). Personally I do that anyway only
rarely, for specific languages only, and just out of academical
interest.
>[...]>
Bart is an expert at thinking up things in C that confuse him.
Well, that's an own topic. - Where I was really astonished was the
statement of being confused about the braces/semicolons, which is
so fundamental (and primitive) but technically just a detail that
I'd thought it should be clear
Apparently the first line here needs a semicolon after }, the second doesn't:
int X[1] = {0};
void Y() {}
Similarly here:
if (x) y;
if (x) {}
Why?
"Because that's what the grammar says" isn't a valid answer.
The C language is one of the most quirky ones around full of apparently ridiculous things. Why shouldn't you be able to write this for example:
{
....
L:
}
This stupid rule means that EVERY label in my generated code needs to be written as L:; instead of just L:
Please don't say the label is only defined to be a prefix to another statement. I asking why it was done like that.
Les messages affichés proviennent d'usenet.