[ale] Battling Distros and unwrapped '#include's

James Sumners james.sumners at gmail.com
Wed Apr 30 14:06:04 EDT 2008


Why are you assigning the data types in that fasion? Shouldn't you be
doing this?:

<common.h>
typedef u8 unsigned char;
typedef u16 unsigned short;
.
.
.
.
.


On Wed, Apr 30, 2008 at 1:23 PM, John Mills <johnmills at speakeasy.net> wrote:
> ALErs -
>
>  Different engineers in our development group use different Linux distros
>  and we seem to have a cross-file of system *.h files defining basic types.
>
>  In particular, one of our own product's files attempts to conditionally
>  define basic integer types as follows:
>
>  ************<common.h>********************
>  /* Types */
>
>  #ifndef __u8
>  #define __u8 unsigned char
>  #endif
>  #ifndef __u16
>  #define __u16 unsigned short
>  #endif
>  #ifndef __u32
>  #define __u32 unsigned long
>  #endif
>  #ifndef __s8
>  #define __s8 signed char
>  #endif
>  #ifndef __s16
>  #define __s16 signed short
>  #endif
>  #ifndef __s32
>  #define __s32 signed long
>  #endif
>
>  *****************************************
>
>  Three distros react in different ways to this fragment:
>
>  1. openSuSE-10.x can't build if these definitions are _not_ included, but
>  crashes on duplicated definitions from <asm/types.h> if I instead include
>  <linux/types.h>. Specifically with a flurry of:
>
>   "/usr/include/asm/types.h:13: error: duplicate -1signed"
>
>  2. FC8 can't build if these definitions _are_ included, on account of
>  duplicate declarations.
>
>  3. Ubuntu-8.04 doesn't care - it apparently wraps these types properly.
>
>  First, the "#ifndef/#endif" contructions clearly don't work properly with
>  'typedef' defined types, and
>  Second, there seem to be problems with the system '#include's wrappers, at
>  least in openSuSE.
>
>  Any suggestions how to code around this in a fairly portable fashion? We
>  have conditional compilation for other targets, but for our purposes it
>  would be good to have a single target for our Linux/x86 builds.
>
>  TIA for any clever ideas.
>
>   - Mills
>
>  _______________________________________________
>  Ale mailing list
>  Ale at ale.org
>  http://mail.ale.org/mailman/listinfo/ale
>



-- 
James Sumners
http://james.roomfullofmirrors.com/

"All governments suffer a recurring problem: Power attracts
pathological personalities. It is not that power corrupts but that it
is magnetic to the corruptible. Such people have a tendency to become
drunk on violence, a condition to which they are quickly addicted."

Missionaria Protectiva, Text QIV (decto)
CH:D 59


More information about the Ale mailing list