Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: fdtable



> >Shouldn't fdtable[] be `signed char'? (Yes.)
> 
> Careful!  The `signed' keyword does not exist in K&R C.  We should
> either avoid its usage altogether, or do a feature test for it.  I
> think all K&R compilers have char signed by default, so this should
> work.

OK, here's a configure version.  I haven't rerun autoconf; that needs
to be done for this to take effect.

By the way, the previous test in configure, for casting signed to
unsigned, isn't being cached properly.  I think that's because of the
name of the variable.

*** config.h.in.sig	Tue May  7 15:42:38 1996
--- config.h.in	Tue May  7 15:57:52 1996
***************
*** 96,101 ****
--- 96,104 ----
  /* Define to 1 if compiler incorrectly cast signed to unsigned */
  #undef BROKEN_SIGNED_TO_UNSIGNED_CASTING
  
+ /* Define to 1 if compiler handles `signed' keyword */
+ #undef HAVE_SIGNED_KEYWORD
+ 
  /* Define if your system defines TIOCGWINSZ in sys/ioctl.h.  */
  #undef GWINSZ_IN_SYS_IOCTL
  
*** configure.in.sig	Fri May  3 20:54:33 1996
--- configure.in	Tue May  7 16:00:39 1996
***************
*** 154,159 ****
--- 154,167 ----
    AC_DEFINE(BROKEN_SIGNED_TO_UNSIGNED_CASTING)
  fi
  
+ dnl  Checking if complier handles `signed' keyword
+ AC_CACHE_CHECK(if the signed keyword is handled, zsh_cv_signed_keyword,
+ [AC_TRY_COMPILE(, [signed char foo; foo = -1;],
+ zsh_cv_signed_keyword=yes, zsh_cv_signed_keyword=no)])
+ if test $zsh_cv_signed_keyword = yes; then
+   AC_DEFINE(HAVE_SIGNED_KEYWORD)
+ fi
+ 
  dnl ------------------
  dnl CHECK FOR PROGRAMS
  dnl ------------------
*** Src/globals.h.sig	Tue May  7 15:43:49 1996
--- Src/globals.h	Tue May  7 15:56:39 1996
***************
*** 397,403 ****
--- 397,408 ----
   * table is not used.  A table element is set by movefd and cleard *
   * by zclose.                                                      */
  
+ #ifdef HAVE_SIGNED_KEYWORD
+ EXTERN signed char fdtable[OPEN_MAX];
+ #else
+ /* If `signed' does not exist, we assume char's are signed anyway. */
  EXTERN char fdtable[OPEN_MAX];
+ #endif
  
  /* input fd from the coprocess */
  
-- 
Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.




Messages sorted by: Reverse Date, Date, Thread, Author