Hi!
"Vladislav" == Vladislav Vaintroub <wlad@montyprogram.com> writes:
-----Original Message----- From: maria-developers- bounces+wlad=montyprogram.com@lists.launchpad.net [mailto:maria- developers-bounces+wlad=montyprogram.com@lists.launchpad.net] On Behalf Of Steve Ellcey Sent: Freitag, 28. Oktober 2011 22:38 To: maria-developers@lists.launchpad.net 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.
Vladislav> Hi, Vladislav> I would prefer not to use ulong at all. It is not uniformly 64 bit on 64 bit Vladislav> OSes. If one needs unsigned integer that 64 bit on 64 bit OSes, and 32 or 32 Vladislav> bit, size_t seems to be the right choice to me, at least I have not seen Vladislav> exceptions from this rule (but though someone mentioned that on Cray that Vladislav> would not work:). uintptr_t sounds ok too. size_t is not a good choice as it's signed on some platforms. uintptr_t is not a good thing either, as it has to do with pointers, not integer handling (will look strange in function prototypes). 'ulong' stands in MariaDB for 'the most efficient integer type that is may be longer than uint. I don't think it's a problem to use ulong as long as you don't mix it with uint / ulonglong without casting. That said, as this is fixed in 5.5 and there is no known problem with MariaDB 5.3 related to this, this shouldn't be a big issue. Vladislav> If nothing else, there would be thousands less warnings on Win64 if people Vladislav> avoided ulong usage. ulong should only be given to functions that takes ulong, in which case there is no be any warnings. I do agree that we need to ensure that types are used consistently so that we in the end get no warnings at all. Regards, Monty