www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/07/28/21:42:29

From: cgf AT cygnus DOT com (Christopher G. Faylor)
Subject: Re: <sys/unistd.h> not namespace-clean
28 Jul 1998 21:42:29 GMT :
Message-ID: <6plgk5$4j2$1@cronkite.cygnus.com>
References: <19980728040344 DOT 57037 DOT cygnus DOT gnu-win32 AT mundook DOT cs DOT mu DOT OZ DOT AU>
X-Newsreader: trn 4.0-test63 (15 March 1998)

In article <19980728040344 DOT 57037 DOT cygnus DOT gnu-win32 AT mundook DOT cs DOT mu DOT OZ DOT AU>,
Fergus Henderson <fjh AT cs DOT mu DOT OZ DOT AU> wrote:
>The bug is that <sys/unistd.h> uses some names that are in the user's
>namespace.  This means that certain programs which ought to work fail
>with strange error messages in system header files.  For example:
>
>	bash$ cat foo.c
>	#define length 42
>	#include <sys/unistd.h>
>	int main() { return 0; }
>
>	bash$ gcc foo.c
>	In file included from C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32
>	\2.7-B19\../../../../i386-cygwin32/include/unistd.h:4,
>			 from foo.c:2:
>	C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\2.7-B19\../../../../i
>	386-cygwin32/include/sys/unistd.h:76: parse error before `42'
>	C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\2.7-B19\../../../../i
>	386-cygwin32/include/sys/unistd.h:77: parse error before `42'
>
>The fix is simple.
>
>--- unistd.h	Thu Feb 26 10:42:23 1998
>+++ unistd.h.fixed	Tue Jul 28 03:51:41 1998
>@@ -73,8 +73,8 @@
> 
> #ifdef __CYGWIN32__
> unsigned _EXFUN(usleep, (unsigned int _useconds ));
>-int     _EXFUN(ftruncate, (int fd, off_t length));
>-int     _EXFUN(truncate, (const char *, off_t length));
>+int     _EXFUN(ftruncate, (int _fd, off_t _length));
>+int     _EXFUN(truncate, (const char *, off_t _length));
> #endif
> 
> # define	F_OK	0

Wouldn't it make more sense to remove the variable names entirely?  That
completely eliminates name space pollution rather than shifting it.
-- 
cgf AT cygnus DOT com             "Everything has a boolean value, if you stand
http://www.cygnus.com/      far enough away from it."  -- Galena Alyson Canada

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019