Liste des Groupes | Revenir à cl c |
On 06/12/2024 00:50, Keith Thompson wrote:Bart <bc@freeuk.com> writes:
[...]This is a discussion of language design. Not one person trying to>
understand how some feature works. I could learn how X works, but that
won't help a million others with the same issue.
That's great, if there are a million other users who are confused
about the same things you claim to be confused about, and if you're
actually trying to help them.
>
Except for a couple of things.
>
I don't believe there are "a million other users" who are confused
about, to use a recent example, C's rules about whether a "}" needs
to be followed by a semicolon. I've seen code with extraneous
semicolons at file scope, and I mostly blame gcc's lax default
behavior for that. But I've never heard anyone other than you
complain about C's rules being intolerably inconsistent.
>
And even if those users exist, I don't see you making any effort
to help them, for example by explaining how C actually works.
(Though you do manage to provoke some of us into doing that for you.)
>
You really think I'm a beginner stumped on some vital question of
whether I should or should not have use a semicolon in a program I'm
writing?
I said I wouldn't be able explain the rules. Otherwise I stumble along
like everyone else.
If I catch sight of this at the top of my screen window:
-------------------------
}
....
is that } ending some compound statement, or is it missing a ";" because
it's initialising some data? Or (if I know I'm outside a function), is
it the end of function definition?
I wouldn't be stumped for long, but it strikes me as odd that you can't
tell just by looking.
I used to be puzzled by this too: 'while' can both start a while
statement, and it can delimit a do-while statement. How is that possible?
Again if you only caught a glimpse like this:
----------------
while (cond);
then /probably/ it is the last line of a do-while, but it could also
legally be a while loop with an empty body. (Maybe temporarily empty, or
the ; is a mistake.)
How about this:
do
{
....
}
while cond();
A do-while, but comment out the 'do', and it's a compound statement
followed by a while loop
This duality of 'while' bothers me.
[...]
Les messages affichés proviennent d'usenet.