Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #390254

Re: Two questions on arrays with size defined by variables

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 2025-02-09 16:38 -0800
Organization None to speak of
Message-ID <877c5yr5vv.fsf@nosuchdomain.example.com> (permalink)
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>

Show all headers | View raw


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 */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-09 08:50 +0100
  Re: Two questions on arrays with size defined by variables Andrey Tarasevich <noone@noone.net> - 2025-02-09 00:06 -0800
    Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-09 10:54 +0100
      Re: Two questions on arrays with size defined by variables Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-09 02:25 -0800
        Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-09 18:17 +0100
          Re: Two questions on arrays with size defined by variables Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-09 16:38 -0800
            Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-10 03:35 +0100
              Re: Two questions on arrays with size defined by variables James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-09 23:03 -0500
              Re: Two questions on arrays with size defined by variables Andrey Tarasevich <noone@noone.net> - 2025-02-09 20:14 -0800
                Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-10 07:43 +0100
                Re: Two questions on arrays with size defined by variables Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-09 22:57 -0800
                Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-10 19:33 +0100
                Re: Two questions on arrays with size defined by variables Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-10 14:17 -0800
      Re: Two questions on arrays with size defined by variables Michael S <already5chosen@yahoo.com> - 2025-02-09 12:39 +0200
        Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-09 18:18 +0100
          Re: Two questions on arrays with size defined by variables Michael S <already5chosen@yahoo.com> - 2025-02-09 19:57 +0200
            Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-09 19:10 +0100
            Re: Two questions on arrays with size defined by variables Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-09 16:46 -0800
              Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-10 02:56 +0100
      Re: Two questions on arrays with size defined by variables antispam@fricas.org (Waldek Hebisch) - 2025-02-09 14:29 +0000
        Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-09 18:19 +0100
          Re: Two questions on arrays with size defined by variables Andrey Tarasevich <noone@noone.net> - 2025-02-09 09:29 -0800
            Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-09 18:46 +0100
              Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-09 18:53 +0100
                Re: Two questions on arrays with size defined by variables James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-09 15:55 -0500
                Re: Two questions on arrays with size defined by variables antispam@fricas.org (Waldek Hebisch) - 2025-02-10 01:36 +0000
                Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-10 03:01 +0100
                Re: Two questions on arrays with size defined by variables David Brown <david.brown@hesbynett.no> - 2025-02-10 11:39 +0100
                Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-10 18:57 +0100
                Re: Two questions on arrays with size defined by variables David Brown <david.brown@hesbynett.no> - 2025-02-10 19:19 +0100
              Re: Two questions on arrays with size defined by variables Michael S <already5chosen@yahoo.com> - 2025-02-09 20:19 +0200
                Re: Two questions on arrays with size defined by variables Opus <ifonly@youknew.org> - 2025-02-10 02:44 +0100
                Re: Two questions on arrays with size defined by variables Michael S <already5chosen@yahoo.com> - 2025-02-10 12:38 +0200
                Re: Two questions on arrays with size defined by variables Opus <ifonly@youknew.org> - 2025-02-10 23:08 +0100
          Re: Two questions on arrays with size defined by variables Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-09 15:50 -0800
            Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-10 03:12 +0100
              Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-10 07:27 +0100
                Re: Two questions on arrays with size defined by variables Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-02-09 22:49 -0800
                Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-10 19:14 +0100
      Re: Two questions on arrays with size defined by variables Andrey Tarasevich <noone@noone.net> - 2025-02-09 07:15 -0800
        Re: Two questions on arrays with size defined by variables Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-09 18:20 +0100
        Re: Two questions on arrays with size defined by variables James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-09 15:34 -0500
      Re: Two questions on arrays with size defined by variables James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-09 15:27 -0500
    Re: Two questions on arrays with size defined by variables James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-02-09 15:16 -0500
    Re: Two questions on arrays with size defined by variables Tim Rentsch <tr.17687@z991.linuxsc.com> - 2025-02-15 08:19 -0800

csiph-web