From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 19:02:54 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C7031065694 for ; Sun, 13 Feb 2011 19:02:54 +0000 (UTC) (envelope-from bakul@bitblocks.com) Received: from mail.bitblocks.com (mail.bitblocks.com [64.142.15.60]) by mx1.freebsd.org (Postfix) with ESMTP id 736F98FC19 for ; Sun, 13 Feb 2011 19:02:54 +0000 (UTC) Received: from bitblocks.com (localhost.bitblocks.com [127.0.0.1]) by mail.bitblocks.com (Postfix) with ESMTP id 4A0FC5B44; Sun, 13 Feb 2011 10:54:43 -0800 (PST) To: "Julian H. Stacey" In-reply-to: Your message of "Sun, 13 Feb 2011 13:20:58 +0100." <201102131221.p1DCKxRY077335@fire.js.berklix.net> References: <201102131221.p1DCKxRY077335@fire.js.berklix.net> Comments: In-reply-to "Julian H. Stacey" message dated "Sun, 13 Feb 2011 13:20:58 +0100." Date: Sun, 13 Feb 2011 10:54:42 -0800 From: Bakul Shah Message-Id: <20110213185443.4A0FC5B44@mail.bitblocks.com> Cc: hackers@freebsd.org Subject: Re: man 3 getopt char * const argv[] - is const wrong ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Feb 2011 19:02:54 -0000 On Sun, 13 Feb 2011 13:20:58 +0100 "Julian H. Stacey" 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