List Info

Thread: the rationale for defining macros for simple types?




the rationale for defining macros for simple types?
user name
2006-08-10 11:58:18
  a project that i inherited a while back contains a header
file with
the following macros:

#ifndef UCHAR
#define UCHAR   unsigned char
#endif

#ifndef UINT
#define UINT    unsigned short int
#endif

#ifndef ULONG
#define ULONG   unsigned long int
#endif

#ifndef BOOL
#define BOOL    unsigned int
#endif

#ifndef TRUE
#define TRUE    (1>0)
#define FALSE   !TRUE
#endif


and proceeds to, naturally, define numerous variables using
those
macros.  it's not clear why the original programmer chose
to do it
this way rather than just use <stdint.h> and things
like uint8_t and
so on.  i don't see any overwhelming need to add yet
another level of
complexity when the standard types would seem to do just
fine.

also, i'm uncomfortable by the fact that "UINT"
is defined as being
"unsigned short int", which is visually
misleading.  not to mention
that "unsigned long int" is machine-dependent,
no?

is there a reason for having done it this way in the first
place that
anyone knows of?  or can i just rip all that nonsense out
and use
<stdint.h> types directly?  thanks.

rday
-
To unsubscribe from this list: send the line
"unsubscribe linux-c-programming" in
the body of a message to majordomovger.kernel.org
More majordomo info at  http://vge
r.kernel.org/majordomo-info.html
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )