[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getopt: How to know whether to pass char ** or char *const*?
From: |
Bruno Haible |
Subject: |
Re: getopt: How to know whether to pass char ** or char *const*? |
Date: |
Fri, 26 Oct 2007 11:59:45 +0200 |
User-agent: |
KMail/1.5.4 |
Hi,
Micah Cowan wrote:
> How best do I determine in my code whether I'm using gnulib's
> getopt_long, or the system library (potentially glibc)'s? That is, I
> want to know whether I ought to be passing in a char ** or a
> char*const*, whilst avoiding warnings and the like.
I would pass a 'char **': an implicit cast from 'char **' to 'char *const*'
does not cause a warning.
If you want to use 'char *const*', then not only you need a cast, but also
I would put a comment before the getopt_long invocation saying that the use
of 'const' here is justified only because the OPTS start with a '+' flag.
Bruno