[SDL] C++ / SDL using bool vs. SDL_bool

Vittorio Giovara vittorio.giovara at gmail.com
Sun Mar 17 04:28:21 PDT 2013

Is there any advantage in using bool at all?
As far as I know packing one bit in memory or in a struct will usually
wrap the variable or struct in at least a byte segment in memory; so
using a uint8_t type and a 0 or 1 value could achieve the same thing
and without adding a new type.
Or did I miss something?

Sent from my iPad Mini

On 17/mar/2013, at 00:45, John <john at leafygreengames.com> wrote:

> C99 declares both bool and _Bool, plus a macro, __bool_true_false_are_defined.
> The point of the macro is so you can fix these sort of custom boolean types in older code without breaking anything.
> On 03/16/2013 05:47 PM, Sik the hedgehog wrote:
>> I think C99's support for boolean values consists of stdbool.h and a
>> _Bool type (*not* bool). Correct me if I'm wrong.
>> 2013/3/16, Alex Barry <alex.barry at gmail.com>:
>>> On Sat, Mar 16, 2013 at 4:52 PM, Steven Noonan
>>> <steven at uplinklabs.net>wrote:
>>>> The 'bool' type was added in C99 (see section 7.16 in the C99 standard).
>>> That's true, but I think Sam's logic is to support the lowest common
>>> denominator - in this case, not every compiler will support a bool in
>>> standard C, and it is typical for a C library to define a TRUE/FALSE value.
>>> I think typically, if a programmer is using SDL from C++, they would be
>>> wrapping a lot of functions in C classes where SDL_Bool could be translated
>>> into bool true/false values.
>> _______________________________________________
>> SDL mailing list
>> SDL at lists.libsdl.org
>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

More information about the SDL mailing list