[Fwd: Macros "major" and "minor"]
Tue Jun 15 13:47:00 GMT 2004
----- Forwarded message from Martin Magnusson -----
> Date: Tue, 15 Jun 2004 14:41:32 +0200
> From: Martin Magnusson
> Subject: Macros "major" and "minor"
> To: cygwin ML
> I recently ran into problems when compiling a matrix library containing
> a function called "minor". Apparently, the file
> /usr/include/sys/sysmacros.h has the following definitions:
> #ifdef __CYGWIN_USE_BIG_TYPES__
> #define major(dev) ((int)(((dev) >> 16) & 0xffff))
> #define minor(dev) ((int)((dev) & 0xffff))
> #define makedev(major, minor) (((major) << 16) | ((minor) & 0xffff))
> #define major(dev) ((int)(((dev) >> 8) & 0xff))
> #define minor(dev) ((int)((dev) & 0xff))
> #define makedev(major, minor) (((major) << 8) | ((minor) & 0xff))
> Defining macros with names like "major" and "minor" is really not good,
> IMO. This should probably be changed, if possible.
> / martin
----- End forwarded message -----
While the macros are perfectly fine in sys/sysmacros.h, I was wondering
why he's including sys/sysmacros.h at all. A quick search turned out
that cygwin/types.h includes sys/sysmacros.h. So practically every
project gets "major", "minor" and "makedev" macros defined by just
including any of the standard headers.
So I was wondering why sys/sysmacros.h is included in cygwin/types.h
at all. I found no reason. Even Cygwin builds without it.
If nobody has a good reson to keep sys/sysmacros.h included in
cygwin/types.h, I'll remove the #include soon.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Co-Project Leader mailto:firstname.lastname@example.org
Red Hat, Inc.
More information about the Cygwin-developers