home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / sgi / 16635 < prev    next >
Encoding:
Text File  |  1992-11-18  |  4.1 KB  |  134 lines

  1. Newsgroups: comp.sys.sgi
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!sgigate!sgi!igor!kevin
  3. From: kevin@tamri.com (Kevin Dalley)
  4. Subject: Re: Bug in SGI ansi compliance (or are the others wrong ?)
  5. In-Reply-To: suhonen@jalka.jyu.fi's message of 18 Nov 92 06:41:51 GMT
  6. Message-ID: <KEVIN.92Nov18152303@polkacide.tamri.com>
  7. Lines: 116
  8. Sender: kevin@igor.tamri.com (Kevin Dalley)
  9. Reply-To: kevin@tamri.com
  10. Cc: dhinds@allegro.stanford.edu
  11. Organization: TOSHIBA America MRI, South San Francisco, CA
  12. References: <s5c02sg@sgi.sgi.com> <1992Nov11.225422.2888@bernina.ethz.ch>
  13.     <KEVIN.92Nov17165341@polkacide.tamri.com>
  14.     <SUHONEN.92Nov18084151@jalka.jyu.fi>
  15. Date: Wed, 18 Nov 92 23:23:06 GMT
  16. Lines: 116
  17.  
  18. >>>>> On 18 Nov 92 06:41:51 GMT, suhonen@jalka.jyu.fi (Timo Suhonen) said:
  19. Timo> Would you please list undefined functions, incorrect macro definitions
  20. Timo> and incorrect struct definitions. The list could help programmers to
  21. Timo> avoid broken definitions.
  22.  
  23. Here's a beginning.
  24.  
  25. There are two types of bugs that I describe here.  The "#ifdef sgi"
  26. bugs are described first.  The __STDC__ bugs follow.
  27.  
  28. There are many occurrences of "#ifdef sgi" in the header files.
  29. Someone needs to search through all header files and determine when
  30. "#ifdef sgi" is used to mean "using an sgi machine and libraries".
  31. This instances should be changed to "#ifdef __sgi".
  32.  
  33. In other cases, "#ifdef sgi" may mean "not ansi".  This should be
  34. changed to "#ifndef __STDC__".
  35.  
  36. I complained about some of these problems back in cypress.  They still
  37. have not been fixed.  Some of these problems are unlikely to come up
  38. for most people.  Perhaps you are lucky enough escape unscathed.
  39.  
  40. For example, in X11/Xos.h, this fragment appears:
  41.  
  42. #ifdef SYSV
  43. #ifndef sgi
  44. #include <string.h>
  45. #define index strchr
  46. #define rindex strrchr
  47. #else
  48. #include <strings.h>
  49. #endif
  50. #else
  51. #include <strings.h>
  52. #endif /* SYSV */
  53.  
  54. If "-ansi" is used during compilation, "sgi" is not defined, though
  55. "__sgi" is defined.  "SYSV" should be defined.  "index" is arbitrarily
  56. changed to "strchr" even though both index and strchr are available in
  57. SGI's libraries.  If you happen to have a structure with an element
  58. named index, the element may occasionally be renamed strchr, causing
  59. compilation problems.  Clearly this should be changed to "#ifndef
  60. __sgi".
  61.  
  62. In Intrinsic.h, this fragment appears:
  63.  
  64. #ifdef FUNCPROTO
  65. #undef NeedFunctionPrototypes
  66. #define NeedFunctionPrototypes 1
  67. #ifdef sgi
  68. #undef NeedWidePrototypes
  69. #define NeedWidePrototypes 0
  70. #endif /* sgi */
  71. #else
  72. #undef NeedFunctionPrototypes
  73. #define NeedFunctionPrototypes 0
  74. #undef NeedWidePrototypes
  75. #define NeedWidePrototypes 0
  76. #endif
  77.  
  78. If "-ansi" is used, NeedFunctionPrototypes is set to 0, since "sgi" is
  79. not defined.  Therefore function prototypes are not used.
  80.  
  81. In ProtocolsP.h, this appears:
  82.  
  83. typedef struct _XmProtocolClassPart{
  84.     XtPointer    extension;
  85. #ifdef sgi
  86. /* Allow future extensions without breaking shared library compatibility */
  87.     caddr_t    _SG_vendorExtension;
  88. #endif /* sgi */
  89. }XmProtocolClassPart;
  90.  
  91. The structure XmProtocolClassPart is defined differently depending
  92. upon when "-ansi" is used.  This is not desirable.
  93. Similarly with XmProtocolPart later in the same file.
  94.  
  95. In resolv.h, _PATH_RESCONF is incorrectly defined if "-ansi" is used.
  96. scnhdr.h incorrectly uses "#ifdef sgi".
  97.  
  98. In sys/socket.h, many socket function are undefined when "-ansi" is
  99. used.  As far as I know accept is compatible with ansi c.
  100.  
  101. There are many other header files that have this problem.  The header
  102. files need to be rewritten.
  103.  
  104.  
  105.  
  106.  
  107. In addition there are problems with the use of __STDC__.  I have been
  108. informed that the next release of Irix will by default defined
  109. __STDC__ even when "-ansi" is not used.
  110.  
  111. In stdio.h, remove and rename are undefined when __STDC__ is undefined.
  112.  
  113. In Intrinsic.h, this fragment occurs:
  114.  
  115. #ifdef __STDC__
  116. typedef void*        XtPointer;
  117. #else
  118. typedef char*        XtPointer;
  119. #endif
  120.  
  121. Clearly, "void *" is preferable to "char *" even if the compiler is
  122. not strictly ansi.
  123.  
  124.  
  125.  
  126.  
  127. There are other cases of both types of errors.  The second type will
  128. be handled by the next release.  I have hopes that SGI
  129. will finally correct the first problem during that release.
  130. --
  131. Kevin Dalley
  132. Toshiba America MRI, Inc.
  133. kevin@tamri.com
  134.