linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@mindspring.com>
To: C programming list <linux-c-programming@vger.kernel.org>
Subject: the rationale for defining macros for simple types?
Date: Thu, 10 Aug 2006 07:58:18 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0608100754040.11910@localhost.localdomain> (raw)


  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

             reply	other threads:[~2006-08-10 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-10 11:58 Robert P. J. Day [this message]
2006-08-10 20:57 ` the rationale for defining macros for simple types? Glynn Clements
  -- strict thread matches above, loose matches on Subject: below --
2006-08-10 15:35 Smith, Jason - VA
2006-08-10 15:45 ` Robert P. J. Day
2006-08-10 16:06 ` Robert P. J. Day

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0608100754040.11910@localhost.localdomain \
    --to=rpjday@mindspring.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).