This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] microMIPS support
On Fri, 27 Apr 2012, Jan Kratochvil wrote:
> > But are you absolutely sure that it was a supported construct with C89 or
> > are you only assuming having no counter-evidence?
>
> (a) C89 == C90: http://en.wikipedia.org/wiki/C89_%28C_version%29#C89
> (b) The suggested 'const' construct is compliant with 'gcc -std=c89 -pedantic'.
> This does not prove it is really C89 compliant but:
In the absence of an actual copy of the standard itself checking with a
third-party known-C89/C90-only compiler would be better.
> (c) GDB codebase is already not C90 compliant, at least not
> with 'gcc -std=c89 -pedantic', as discussed in the thread
> Re: [no-commit-intention] Naive unnamed fields for main_type
> http://sourceware.org/ml/gdb-patches/2012-02/msg00146.html
These are merely bugs IMO, that should simply be fixed instead (and some
are outside GDB, readline for one is not a part of GDB, just bundled for
convenience, and optional, though I'd agree that using GDB's CLI without
readline is a bit painful). We shouldn't deliberately create new bugs on
the basis we already have some. ;)
As I say I'd be first happy to hear we can finally switch to C99.
> I checked according to C90 const array means const elements of the array.
> And 'const type *var;' does not make 'var' const - my conclusion is qualifier
> 'const' is therefore independent for 'var' and the target type.
"const type *var" is a pointer to a variable of "const type" type.
"type *const var" is a const pointer to a variable of "type" type.
> > At the time I learnt C (some 18 years ago) that certainly wasn't a
> > construct I had seen in any language reference
>
> I do not see any problem using const for an array, what specifically do you
> see wrong here?
Not a const array, but a const pointer.
> > AFAIK we still require our code to conform to C89 (fortunately not K&R
> > anymore) or we could use lots of good stuff,
>
> I agree. I find const arrays compliant with C89.
But this is about an array of const pointers, I wouldn't see any problem
with an array of const arithmetic-type elements.
So far it's your word against mine, I'd like to hear from someone else
too. I'll accept whatever their decision will be.
Maciej