This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
[Fwd: Macros "major" and "minor"]
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: cygwin-developers at cygwin dot com
- Date: Tue, 15 Jun 2004 15:47:08 +0200
- Subject: [Fwd: Macros "major" and "minor"]
- Reply-to: cygwin-developers at cygwin dot com
----- 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))
> #else
> #define major(dev) ((int)(((dev) >> 8) & 0xff))
> #define minor(dev) ((int)((dev) & 0xff))
> #define makedev(major, minor) (((major) << 8) | ((minor) & 0xff))
> #endif
>
> 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
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Co-Project Leader mailto:cygwin@cygwin.com
Red Hat, Inc.