Sujet : Re: Two questions on arrays with size defined by variables
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 10. Feb 2025, 01:38:12
Autres entêtes
Organisation : None to speak of
Message-ID : <877c5yr5vv.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5
User-Agent : Gnus/5.13 (Gnus v5.13)
Janis Papanagnou <janis_papanagnou+
ng@hotmail.com> writes:
On 09.02.2025 11:25, Keith Thompson wrote:
[...]
The first line needs to be `int main(void)`. The "implicit int"
misfeature was removed in C99. [...]
>
Thanks. (Again answering more/something different than I asked.) :-)
>
Please note that I structurally illustrated just the posters question
about where the relevant code excerpt resides (file scope or else).
>
If I'd knew the audience is picky I'd posted the whole test program;
but then there's even much more picky comments to expect. ;-)
Yeah, we're picky here.
I hope to mollify the audience if I point out that my code actually
looks *like* this
>
...
int main (int argc, char * argv[])
{
...
return 0;
}
>
(And, yes, I know that the "..." is not correct, and argc is unused,
and I omitted 'const', etc.)
It's clear enough that the "..." is figurative. As picky as I am,
I wouldn't have commented on it. "// ..." or "/* ... */" is more
pedantically correct, but whatever.
(Incidentally, Perl has a "..." operator, nicknamed the Yada Yada
operator, intended to mark placeholder code that is not yet
implemented.)
The "return 0;" is unnecessary but harmless in C99 and later.
As for "const", there's nothing in the above snippet that requires it.
You can probably add a const or two to the argv declaration:
const char *const *argv
but the standard doesn't include "const" in the declaration of argv.
Strictly speaking, adding "const" probably makes the program's behavior
undefined.
[...]
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */