man 3 getopt char * const argv[] - is const wrong ?
Bakul Shah
bakul at bitblocks.com
Sun Feb 13 19:02:54 UTC 2011
On Sun, 13 Feb 2011 13:20:58 +0100 "Julian H. Stacey" <jhs at berklix.com> wrote:
> Hi Hackers
> Ref.: man 3 getopt
> int getopt(int argc, char * const argv[], const char *optstring);
>
> Ref.: K&R 2nd Ed P.211 last indent, 2nd sentence
> The purpose of const is to announce objjects that may be
> placed in read-only memory, and perhaps to increas opportunities
> for optimization
>
> optstring is obviously const,
> but I don't see that argv can calim to be const ?
>
> Did some ISO standard redefine const ? If so URL please ?
> (I learnt my C from K&R #1 decades ago :-)
Not quite what you asked for but this may help in making
sense of const....
$ cdecl # from /usr/ports/devel/cdecl
explain const char* x
declare x as pointer to const char
explain char * const x
declare x as const pointer to char
More information about the freebsd-hackers
mailing list