| Deutsch English Français Italiano |
|
<877c5yr5vv.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Two questions on arrays with size defined by variables
Date: Sun, 09 Feb 2025 16:38:12 -0800
Organization: None to speak of
Lines: 51
Message-ID: <877c5yr5vv.fsf@nosuchdomain.example.com>
References: <vo9mns$gsd7$1@dont-email.me> <vo9nn3$gtph$1@dont-email.me>
<vo9u0u$i0n8$1@dont-email.me>
<878qqf1kl2.fsf@nosuchdomain.example.com>
<voanvq$o6uh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Mon, 10 Feb 2025 01:38:13 +0100 (CET)
Injection-Info: dont-email.me; posting-host="f4acd3ba793eeb2facf0b27d62bf5cd0";
logging-data="945334"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wPUEA2TtvwXIW4pD8YSjO"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:706L4EDT8LWlUzmQMNFGn322/mM=
sha1:Rcf3IQz7Mq0fU+Zp/zWopecKkBc=
Bytes: 2830
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.com
void Void(void) { Void(); } /* The recursive call of the void */