On Wed, Feb 4, 2009 at 2:11 AM, Monty Taylor <[email protected]> wrote:

> As a general note, we have an ongoing task to get rid of ulong (and
> long). So if  you're working along and see stuff like this (from
> drizzled/function/time/typecast.cc)
>
>       snprintf(char_type, sizeof(char_type), "%s(%lu)",
>                cast_cs == &my_charset_bin ? "BINARY" : "CHAR",
>                (ulong) cast_length);
>
> Go ahead and change that to (in this case, since cast_length is an int):
>
>       snprintf(char_type, sizeof(char_type), "%s(%d)",
>                cast_cs == &my_charset_bin ? "BINARY" : "CHAR",
>                cast_length);
>
> However, of course, int may not actually be appropriate for cast_length.
> It might should be int32_t, int64_t, uint32_t, uint64_t -- or, if it
> needs to vary based on platform (32/64bit stuff), size_t or ssize_t.
>
> Just for completeness, if you had changed it to uint32_t... (guessing,
> based on the above casting to ulong)
>
>       snprintf(char_type, sizeof(char_type), "%s(%"PRIu32")",
>                cast_cs == &my_charset_bin ? "BINARY" : "CHAR",
>                cast_length);
>
> Using the inttypes macros from C99.
>

Thanks for that info. I'll know to look out for stuff like that in the
future. I just noticed the blueprint for this task after reading your email
so next time I'm working on a piece of code like this, I'll take it into
account.

-Padraig


>
> Thanks!
> Monty
>
> _______________________________________________
> Mailing list: 
> https://launchpad.net/~drizzle-discuss<https://launchpad.net/%7Edrizzle-discuss>
> Post to     : [email protected]
> Unsubscribe : 
> https://launchpad.net/~drizzle-discuss<https://launchpad.net/%7Edrizzle-discuss>
> More help   : https://help.launchpad.net/ListHelp
>
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to