← 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 Michael Widenius
> Sent: Freitag, 4. November 2011 12:11
> To: Jakob Lorberblatt
> Cc: maria-developers@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [Maria-developers] Bug in ENUM options handling?
> 
> 
> Hi!
> 
> >>>>> "Jakob" == Jakob Lorberblatt <jakob@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> 
> Jakob> I believe the the debate ongoing below can be laid to rest at
*MOST*
> Jakob> platforms size_t will work correctly, I have found few exceptions,
> such as
> Jakob> GCC prior to 2.4 size_t is defined as a signed integer, in
sys/types.h to
> Jakob> match the definitions located in this file for other nix related
> Jakob> platforms, and stddef.h just includes this definition; this is a
very old
> Jakob> version of GCC and I believe (correct me if I am wrong) it would
not
> Jakob> compile MariaDB's source code anyway, not positive though haven't
> tried
> Jakob> it.
> 
> I have compiled and used MySQL with very old versions of gcc and with
> systems where size_t is signed.  I don't think it would be hard to get
> the current code to work on these systems.

There is no urgent need to port MariaDB or MySQL to very old gcc.

> The issue I have mainly with size_t for enum is that in some people's
> mind it's not guaranteed to be unsigned and because of that it's not a
> perfect choice.

For enum, signed or not should not be a big deal. As I see it, even signed
char with would suffice.

> Personally I prefer to use 'uint, ulong, ulonglong' or even
> uint32 and uint32 instead of size_t for some objects.

I understand.  As long as everyone is using GCC with default setting, which
does not warn about implicit conversion, one cannot see which  of  implicit
conversions resulting in 12872 warnings here
http://buildbot.askmonty.org/buildbot/builders/win2008r2-vs2010-amd64-packag
es/builds/248 are noise, and which ones are not.  I used to babysit the
build looking for new warning after someone else's push, but I stopped doing
that and the number of warnings has approximately doubled since.

To fix that cleanly, it is not just enough to eliminate ulong. One would
also need to enable -Wno-conversion on newer GCC (this at least catches
conversions not involving ulong , e.g longlong to int, double to char), and
as long as you prefer using smaller than natural types, write code full of
casts , or just adopt size_t whenever appropriate.

Wlad
 





References