Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-16 Thread Matthias Andree
Am 15.02.2011 04:19, schrieb Julian H. Stacey:
 and the SUS is available free of charge, that's 
 
 Again you fail to post a precise complete URL for free open anonymous
 reference.  One might wonder your involvment with open.org/ISO/IEEE.

I don't care to do the searching for you, nor discuss any of this,
in particular because you are distracting from your actual getopt(3)
concern with random sidesteps.  And that's already one more reason that
I've given than you've deserved.

Let's stick to the technical discussion.

 language, 2nd edition, then getopt() isn't even in my printed book's index.
 
 Yet again: The point is to find the latest specification
 of C language const Before considering latest getopt().

No it isn't, that is another of your distractions.

The explanations about const are all there and you haven't yet clarified
your concern about const-ness of the argv pointers in said getopt argument.

I don't care about policies, standardization, affiliations, unless you
document the technical concern that you see in the const in getopt()'s
char * const argv[] argument.  And before that happens I'm not even
interested in a pseudo-technical discussion.

Try comp.lang.c for a change.

-- 
Matthias Andree
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-16 Thread Julian H. Stacey
Bruce Cran wrote:
 It seems registration is required for the SUS, but you can get
 POSIX.1-2008 free at http://pubs.opengroup.org/onlinepubs/9699919799/ .

Thanks Bruce.
I browsed it but couldn't find a C spec.  
Opengroup.org server restricted the URL to a constant:
http://pubs.opengroup.org/onlinepubs/9699919799/nframe.html

Hoping for full URLs (or more) I tried:
http://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?reload=truepunumber=4694974
It needed a login.  I created one. IEEE harvested my address then responded:
  Full text access is unavailable with your individual subscription

Cheers,
Julian
-- 
Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com
 Mail plain text;  Not quoted-printable, Not HTML, Not base 64.
 Reply below text sections not at top, to avoid breaking cumulative context.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-16 Thread Matthias Andree
Am 16.02.2011 19:31, schrieb Julian H. Stacey:
 Bruce Cran wrote:
 It seems registration is required for the SUS, but you can get
 POSIX.1-2008 free at http://pubs.opengroup.org/onlinepubs/9699919799/ .
 
 Thanks Bruce.
 I browsed it but couldn't find a C spec.  
 Opengroup.org server restricted the URL to a constant:
   http://pubs.opengroup.org/onlinepubs/9699919799/nframe.html

Depends on your browser features - you need a frame-capable browser for
the URL that Bruce posted.  But POSIX.1-2008 is the same as the Single
Unix Specification v4 or IEEE Std 1003.1-2008.

Neither gives you the C specification.

 Hoping for full URLs (or more) I tried:
 http://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?reload=truepunumber=4694974
 It needed a login.  I created one. IEEE harvested my address then responded:
   Full text access is unavailable with your individual subscription

IEEE does, quite obviously, not have ISO standards.

-- 
Matthias Andree
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-16 Thread Joerg Sonnenberger
On Wed, Feb 16, 2011 at 07:41:02PM +0100, Matthias Andree wrote:
 But POSIX.1-2008 is the same as the Single
 Unix Specification v4 or IEEE Std 1003.1-2008.

Minor correction, it is SUS v3 Issue 7.

Joerg
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-16 Thread Matthias Andree
Am 16.02.2011 20:02, schrieb Joerg Sonnenberger:
 On Wed, Feb 16, 2011 at 07:41:02PM +0100, Matthias Andree wrote:
 But POSIX.1-2008 is the same as the Single
 Unix Specification v4 or IEEE Std 1003.1-2008.
 
 Minor correction, it is SUS v3 Issue 7.

No it isn't. See http://www.unix.org/version4/ieee_std.html

-- 
Matthias Andree
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-16 Thread Joerg Sonnenberger
On Wed, Feb 16, 2011 at 08:26:04PM +0100, Matthias Andree wrote:
 Am 16.02.2011 20:02, schrieb Joerg Sonnenberger:
  On Wed, Feb 16, 2011 at 07:41:02PM +0100, Matthias Andree wrote:
  But POSIX.1-2008 is the same as the Single
  Unix Specification v4 or IEEE Std 1003.1-2008.
  
  Minor correction, it is SUS v3 Issue 7.
 
 No it isn't. See http://www.unix.org/version4/ieee_std.html

POSIX.1-2008 is simultaneously IEEE Std 1003.1™-2008 and The Open Group
technical Standard Base Specifications, Issue 7.

Let's agree on that :)

http://pubs.opengroup.org/onlinepubs/9699919799/mindex.html

Joerg
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-16 Thread Matthias Andree
Am 16.02.2011 21:13, schrieb Joerg Sonnenberger:
 On Wed, Feb 16, 2011 at 08:26:04PM +0100, Matthias Andree wrote:
 Am 16.02.2011 20:02, schrieb Joerg Sonnenberger:
 On Wed, Feb 16, 2011 at 07:41:02PM +0100, Matthias Andree wrote:
 But POSIX.1-2008 is the same as the Single
 Unix Specification v4 or IEEE Std 1003.1-2008.

 Minor correction, it is SUS v3 Issue 7.

 No it isn't. See http://www.unix.org/version4/ieee_std.html
 
 POSIX.1-2008 is simultaneously IEEE Std 1003.1™-2008 and The Open Group
 technical Standard Base Specifications, Issue 7.
 
 Let's agree on that :)
 
 http://pubs.opengroup.org/onlinepubs/9699919799/mindex.html

Fine. :) Note that The Open Group Technical Standard Base
Specifications isn't the same as the Single Unix Specification.

-- 
Matthias Andree
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-15 Thread Bruce Cran
On Tue, 15 Feb 2011 04:19:10 +0100
Julian H. Stacey j...@berklix.com wrote:

 Again you fail to post a precise complete URL for free open anonymous
 reference.  One might wonder your involvment with open.org/ISO/IEEE.

It seems registration is required for the SUS, but you can get
POSIX.1-2008 free at http://pubs.opengroup.org/onlinepubs/9699919799/ .

-- 
Bruce Cran
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-14 Thread Matthias Andree

Am 14.02.2011 03:41, schrieb Julian H. Stacey:


Well, instead of ranting,


An inadvisable epithet !

Maybe you never had the luxury of working when one could buy a slim
KR,  it was all one needed.  Now ISO sell standards, Not all free
download.  For C I've only found enormous PDFs. Some downloads may
not be newest/or might need logins or license or payment.  Apache.org
set a better example of free unobstructed hypertexted access to all
versions of eg http.conf etc.


Where have you been living the past two decades?  It's been a not so 
recent development that small language cores (C, Java) are accompanied 
by humongous amounts of documentation for standard libraries...


I understand the concerns about licensing, yet I see standards as 
reference material, and the SUS is available free of charge, that's 
about as much as I care for the current discussion.


Take the political parts up with the respective entities and/or possibly 
the FreeBSD foundation.



Using Unix  C since '77,  '82, I 'appreciate' C is a heavily
evolved = bent language.  Const as case in point: FreeBSD getopt
seems to conflict with KR#2 so ...


If KR #2 is supposed to be Kernighan  Ritchie, The C Programming 
language, 2nd edition, then getopt() isn't even in my printed book's index.



It would be nice to download a new C standard for reference.  Is


Yes.


the newest definition of C free public access ? Is there a URL


I never bothered to check.  Check the final drafts that are getting 
voted becomes standard yes/no on, they are usually free.


--
Matthias Andree
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-14 Thread Julian H. Stacey
 I understand the concerns about licensing, yet I see standards as 
 reference material,

ISO products are not standard when ISO restricts access by charging
fees so they're not freely distributable to all individual programmers
for reference in free software developer communities.

Only draft ISO are freely available.  FreeBSD  Linux  Apache 
RFCs etc do better than ISO, publishing de facto standards as
documentation  source free of charge.


and the SUS is available free of charge, that's 

Again you fail to post a precise complete URL for free open anonymous
reference.  One might wonder your involvment with open.org/ISO/IEEE.


 Take the political parts up with the respective entities and/or possibly 
 the FreeBSD foundation.

If free source developers co-operate on de facto
standards, ISO may be ignored as an obstruction.


 language, 2nd edition, then getopt() isn't even in my printed book's index.

Yet again: The point is to find the latest specification
of C language const Before considering latest getopt().


  It would be nice to download a new C standard for reference.  Is
 
 Yes.
 
  the newest definition of C free public access ? Is there a URL
 
 I never bothered to check.  Check the final drafts that are getting 
 voted becomes standard yes/no on, they are usually free.

You Never bother to post precise URLs to list, please stop posting.

A reminder for others

I have found this free downloadable C spec
 http://www.open-std.org/JTC1/SC22/WG14/www/standards

 Is there a URL newer/ better than what I posted ?

Cheers,
Julian
-- 
Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com
 Mail plain text;  Not quoted-printable, Not HTML, Not base 64.
 Reply below text sections not at top, to avoid breaking cumulative context.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-13 Thread Matthias Andree
Am So, 13.02.2011, 13:20 schrieb Julian H. Stacey:
 Hi Hackers
 Ref.: man 3 getopt
   int getopt(int argc, char * const argv[], const char *optstring);
 Ref.: KR 2nd Ed P.211 last indent, 2nd sentence
   The purpose of const is to announce [objects] that may be
   placed in read-only memory, and perhaps to increas[e] opportunities for
optimization
 optstring is obviously const,
 but I don't see that argv can calim to be const ?

Hi Julian,

the prototype is in line with the Single Unix Specification v4 aka IEEE
Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check
http://www.opengroup.org/ you can access it free of charge after
registering name and email address).

The const basically states that the argv[] elements (i. e. the char *
pointers) are const[ant], or, read another way, that getopt promises not
to mess with the *pointers* but is free to modify the actual strings
pointed to (with the usual constraints of not assuming they can be
extended, for instance) - and I don't see the problem in that.

Does that help?  If not, please explain you confusion in a bit more detail.

Best
Matthias

-- 
Matthias Andree


___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-13 Thread Jilles Tjoelker
On Sun, Feb 13, 2011 at 01:59:38PM +0100, Matthias Andree wrote:
 Am So, 13.02.2011, 13:20 schrieb Julian H. Stacey:
  Hi Hackers
  Ref.: man 3 getopt
  int getopt(int argc, char * const argv[], const char *optstring);
  Ref.: KR 2nd Ed P.211 last indent, 2nd sentence
  The purpose of const is to announce [objects] that may be
  placed in read-only memory, and perhaps to increas[e] opportunities for
  optimization

const only rarely allows optimization, mostly because a declaration like
const foo *p only says that the foo may not be modified via p, not that
it may not be modified at all.

Another important purpose of const is to allow the programmer to
document what is not changed by a function, and have the compiler check
this documentation.

  optstring is obviously const,
  but I don't see that argv can calim to be const ?

 The const basically states that the argv[] elements (i. e. the char *
 pointers) are const[ant], or, read another way, that getopt promises not
 to mess with the *pointers* but is free to modify the actual strings
 pointed to (with the usual constraints of not assuming they can be
 extended, for instance) - and I don't see the problem in that.

getopt() should not modify the strings themselves either, but there are
at least two reasons why the type is not const char *const argv[]:

1. Elements of argv are written into char *optarg.

2. Many programs declare main's second argument as char *argv[] which
   cannot be converted to const char *const [], other than via a cast.

-- 
Jilles Tjoelker
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-13 Thread Julian H. Stacey
Hi,
Thanks to all respondents, I'll re-read comments in a bit,
I went searching for reference:

Matthias wrote:
 the prototype is in line with the Single Unix Specification v4 aka IEEE
 Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check
 http://www.opengroup.org/ you can access it free of charge after
 registering name and email address).

Thanks, but I didn't find it.
( I used X Open's Search but wan't easy, (I recall fat green
cardboard boxes from XOpen 20+ years back) : impression
remains: opaque unattractive.  Part of the attraction of C
was a slim light affordable volume, 1cm thick, well written,
2 indexes, easy reading, carrying  reference :-)

Oh for a free modern cross reference style C definition in
Asc  HTML like http://apache.org has on line for httpd.conf
... Not old PDF (harder to search), or money wanting ISO,
or login wanting Xopen.

Or a same style KR#3 ?
Prentice hall ...
http://www.pearsonhighered.com/
Yawn ...

http://www.google.de/search?hl=ensource=hpq=The+C+Programming+Language+Third+EditionbtnG=Google+Search

http://www.google.de/search?hl=enq=The+C+Programming+Language+Fourth+Editionaq=faqi=aql=oq=

http://wikipedia.org ... 
http://www.open-std.org/JTC1/SC22/WG14/www/standards
no need to create a login, Click on
The lastest publically available version of the standard
is the combined C99 + TC1 + TC2 + TC3, WG14 N1256, dated
2007-09-07. This is a WG14 working paper, but it reflects
the consolidated standard at the time of issue.
 get n1256.pdf ... 550 pages.
P 535 (XPDF number, not visual number on page) in the alphabetic index
(alpha. like the back of the C book, nice) Ref. to 
const type qualifier, 6.7.3
P.120 (XPDF numbering) Footnote 114)
The implementation may place a const object that is not
volatile in a read-only region of storage.

Cheers,
Julian
-- 
Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com
 Mail plain text;  Not quoted-printable, Not HTML, Not base 64.
 Reply below text sections not at top, to avoid breaking cumulative context.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-13 Thread Matthias Andree
Am 13.02.2011 18:15, schrieb Julian H. Stacey:
 Hi,
 Thanks to all respondents, I'll re-read comments in a bit,
 I went searching for reference:

 Matthias wrote:
 the prototype is in line with the Single Unix Specification v4 aka IEEE
 Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check
 http://www.opengroup.org/ you can access it free of charge after
 registering name and email address).
 Thanks, but I didn't find it.

Julian,

Deep link sent off-list. Start page http://www.unix.org/online.html -
sorry that the opengroup.org links led you onto long-winded detours.

   ( I used X Open's Search but wan't easy, (I recall fat green
   cardboard boxes from XOpen 20+ years back) : impression
   remains: opaque unattractive.  Part of the attraction of C
   was a slim light affordable volume, 1cm thick, well written,
   2 indexes, easy reading, carrying  reference :-)

Well, instead of ranting, you might just appreciate the difference
between the core language and ANSI-C (1989/1990) standard library
features, and the enhanced environment that Unix provides nearly two
decades later... Try gcc -std=c89 -pedantic-errors on your average Unix
software for a change... :)

HTH
Matthias
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-13 Thread Bakul Shah
On Sun, 13 Feb 2011 13:20:58 +0100 Julian H. Stacey j...@berklix.com  wrote:
 Hi Hackers
 Ref.: man 3 getopt
   int getopt(int argc, char * const argv[], const char *optstring);
 
 Ref.: KR 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 KR #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
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-13 Thread Bruce Cran
On Sunday 13 February 2011 17:15:37 Julian H. Stacey wrote:
 Hi,
 Thanks to all respondents, I'll re-read comments in a bit,
 I went searching for reference:
 
 Matthias wrote:
  the prototype is in line with the Single Unix Specification v4 aka IEEE
  Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check
  http://www.opengroup.org/ you can access it free of charge after
  registering name and email address).
 
 Thanks, but I didn't find it.
   ( I used X Open's Search but wan't easy, (I recall fat green
   cardboard boxes from XOpen 20+ years back) : impression
   remains: opaque unattractive.  Part of the attraction of C
   was a slim light affordable volume, 1cm thick, well written,
   2 indexes, easy reading, carrying  reference :-)
 

http://www.google.co.uk/search?q=opengroup+getopt gets results for 
1003.1-2004.

-- 
Bruce Cran
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-13 Thread Julian H. Stacey
 Not quite what you asked for but this may help in making
 sense of const
 
 $ cdecl   # from /usr/ports/devel/cdecl

Thanks Bakul, nice !

Cheers,
Julian
-- 
Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com
 Mail plain text;  Not quoted-printable, Not HTML, Not base 64.
 Reply below text sections not at top, to avoid breaking cumulative context.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: man 3 getopt char * const argv[] - is const wrong ?

2011-02-13 Thread Julian H. Stacey
Matthias Andree wrote:
 Am 13.02.2011 18:15, schrieb Julian H. Stacey:
  Hi,
  Thanks to all respondents, I'll re-read comments in a bit,
  I went searching for reference:
 
  Matthias wrote:
  the prototype is in line with the Single Unix Specification v4 aka IEEE
  Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check
  http://www.opengroup.org/ you can access it free of charge after
  registering name and email address).
  Thanks, but I didn't find it.
 
 Julian,
 
 Deep link sent off-list.

Thanks, so open.org quotes for getopt.html
int getopt(int argc, char * const argv[], const char *optstring);
but it would stll be nicer if we could read definition of C  const.  


 Well, instead of ranting,

An inadvisable epithet !

Maybe you never had the luxury of working when one could buy a slim
KR,  it was all one needed.  Now ISO sell standards, Not all free
download.  For C I've only found enormous PDFs. Some downloads may
not be newest /or might need logins or license or payment.  Apache.org
set a better example of free unobstructed hypertexted access to all
versions of eg http.conf etc.  


 you might just appreciate the difference
 between the core language and ANSI-C (1989/1990) standard library
 features, and the enhanced environment that Unix provides nearly two
 decades later... Try gcc -std=c89 -pedantic-errors on your average Unix
 software for a change... :)

Using Unix  C since '77,  '82, I 'appreciate' C is a heavily
evolved = bent language.  Const as case in point: FreeBSD getopt
seems to conflict with KR#2 so ...

It would be nice to download a new C standard for reference.  Is
the newest definition of C free public access ? Is there a URL
newer/ better than what I posted ?  We could put a URL in man gcc
See Also,  if allowed, a copy in /usr/share/doc/
http://www.open-std.org/JTC1/SC22/WG14/www/standards

Cheers,
Julian
-- 
Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com
 Mail plain text;  Not quoted-printable, Not HTML, Not base 64.
 Reply below text sections not at top, to avoid breaking cumulative context.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org