Re: more GDK->GTK mapping



On Thursday, March 01, 2001 at 20:15, egger suse de wrote:
> On  1 Mar, Havoc Pennington wrote:
> 
> > No. You don't want to use signed ints for bitfields, gboolean is a
> > signed int.
> 
>  Why the heck is gboolean signed? This is a design mistake IMHO
>  and should be rectified ASAP as a boolean is either TRUE or FALSE
>  also known as 1 and 0, thus no negative values can happen. It's
>  really a pity that boolean isn't an official type in C99 as it
>  allows some assumptions to be made which would speed up the executables
>  a bit since the compiler can optimize more.
>  Anyways, using unsigned types whereever possible makes the compiler
>  generate better code because it doesn't have to care about possible
>  signedness, however for boolean values the difference might be tiny,
>  yet the opportunity to use bitfields makes it interesting.

I agree. Shouldn't be too hard to change that typedef, since all code
that relies on gboolean being signed is broken anyway...
Besides, why isn't boolean defined like this:

	typedef uint{8,16,32,64}_fast_t gboolean;

About uintXX_fast_t from the GNU libc manuals:

     If you don't need a specific storage size, but want the data
  structure that allows the fastest access while having at least N bits
  (and among data structures with the same access speed, the smallest
  one), use one of these: [..]

I don't know how well that would work with bitfields though...

Oskar Liljeblad (osk hem passagen se)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]