nanogui: typedef int MWBOOL;


Previous by date: 4 Jan 2002 16:05:12 -0000 Re: MWWINDOFBINFO.x and .y, Greg Haerr
Next by date: 4 Jan 2002 16:05:12 -0000 Complete Desktop Refresh, Darran D. Rimron-Molloy
Previous in thread: 4 Jan 2002 16:05:12 -0000 Re: typedef int MWBOOL;, Greg Haerr
Next in thread:

Subject: Re: [nanogui] typedef int MWBOOL;
From: Jordan Crouse ####@####.####
Date: 4 Jan 2002 16:05:12 -0000
Message-Id: <E16MWoD-0001Fg-00@ns.censoft.com>

Whats more, MWBOOL is usually used in either a stack or register context, so 
size isn't really an issue.  Its not like we're allocating huge chunks of 
MWBOOLs on the heap somewhere.

Jordan  

On Thursday 03 January 2002 22:49, Greg Haerr mentioned:
> : Unless I'm mistaken, a boolean value take either the value "true" or
> : "false", some prefer to use "1" or "0", etc.  But in all cases, it has
> : only 2 possible values, shouldn't a unsigned char be more than
> : sufficient to store it instead a wasting 4 bytes of data for it?
>
> The reason for this has to do with some old-time issues
> with C compilers.  Take the following function:
>
> int a = -1;
>
> unsigned char f(void)
> {
>     return a;
> }
>
> vs
>
> int f(void)
> {
>     return a;
> }
>
> if MWBOOL is used completely arbitrarily, such as for the use of
> function return values, then it's a much better idea to declare a function
> returning int than char, for sign extension and other old-fashioned C
> reasons.  It is for this reason and other similar reasons
> that most other software systems will always
> typedef a boolean to be an int, rather than a char size.
> Many systems have big issues with taking the address of a char
> sized parameter, placed as an int on the stack, as well.  There are
> too many problems with older C compilers to use a "char" data
> type for anything other than a known packed array.
>
> Regards,
>
> Greg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####

Previous by date: 4 Jan 2002 16:05:12 -0000 Re: MWWINDOFBINFO.x and .y, Greg Haerr
Next by date: 4 Jan 2002 16:05:12 -0000 Complete Desktop Refresh, Darran D. Rimron-Molloy
Previous in thread: 4 Jan 2002 16:05:12 -0000 Re: typedef int MWBOOL;, Greg Haerr
Next in thread:


Powered by ezmlm-browse 0.20.