← Back to team overview

maria-developers team mailing list archive

Re: Bug in ENUM options handling?

 


> -----Original Message-----
> From: maria-developers-
> bounces+wlad=montyprogram.com@xxxxxxxxxxxxxxxxxxx [mailto:maria-
> developers-bounces+wlad=montyprogram.com@xxxxxxxxxxxxxxxxxxx] On
> Behalf Of Steve Ellcey
> Sent: Freitag, 28. Oktober 2011 22:38
> To: maria-developers@xxxxxxxxxxxxxxxxxxx
> Subject: [Maria-developers] Bug in ENUM options handling?
> 
> While working on MariaDB on HP-UX we noticed an inconsistency involving
> the type of enum arguments.
> 
> In init_variables and init_one_value (mysys/my_getopt.c), ENUM options
> are treated as unsigned longs but the enum arguments are actually
> declared as uint instead of ulong.  While this doesn't matter in 32 bit
> mode when int's and longs's are the same size, it can cause problems in
> 64 bit mode when long's are 64 bits and int's 32 bits.

Hi,
I would prefer not to use ulong at all. It is not uniformly 64 bit on 64 bit
OSes. If one needs unsigned integer that 64 bit on 64 bit OSes, and 32 or 32
bit, size_t  seems to be the right choice to me, at least I have not seen
exceptions from this rule (but though someone mentioned that on Cray that
would not work:). uintptr_t  sounds ok too.
If nothing else, there would be thousands less warnings on Win64 if people
avoided ulong usage.
It one does not want to spare bits, ulonglong seems to be right choice.

Wlad
 




Follow ups

References