home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!sgigate!sgi!igor!kevin
- From: kevin@tamri.com (Kevin Dalley)
- Subject: Re: Bug in SGI ansi compliance (or are the others wrong ?)
- In-Reply-To: suhonen@jalka.jyu.fi's message of 18 Nov 92 06:41:51 GMT
- Message-ID: <KEVIN.92Nov18152303@polkacide.tamri.com>
- Lines: 116
- Sender: kevin@igor.tamri.com (Kevin Dalley)
- Reply-To: kevin@tamri.com
- Cc: dhinds@allegro.stanford.edu
- Organization: TOSHIBA America MRI, South San Francisco, CA
- References: <s5c02sg@sgi.sgi.com> <1992Nov11.225422.2888@bernina.ethz.ch>
- <KEVIN.92Nov17165341@polkacide.tamri.com>
- <SUHONEN.92Nov18084151@jalka.jyu.fi>
- Date: Wed, 18 Nov 92 23:23:06 GMT
- Lines: 116
-
- >>>>> On 18 Nov 92 06:41:51 GMT, suhonen@jalka.jyu.fi (Timo Suhonen) said:
- Timo> Would you please list undefined functions, incorrect macro definitions
- Timo> and incorrect struct definitions. The list could help programmers to
- Timo> avoid broken definitions.
-
- Here's a beginning.
-
- There are two types of bugs that I describe here. The "#ifdef sgi"
- bugs are described first. The __STDC__ bugs follow.
-
- There are many occurrences of "#ifdef sgi" in the header files.
- Someone needs to search through all header files and determine when
- "#ifdef sgi" is used to mean "using an sgi machine and libraries".
- This instances should be changed to "#ifdef __sgi".
-
- In other cases, "#ifdef sgi" may mean "not ansi". This should be
- changed to "#ifndef __STDC__".
-
- I complained about some of these problems back in cypress. They still
- have not been fixed. Some of these problems are unlikely to come up
- for most people. Perhaps you are lucky enough escape unscathed.
-
- For example, in X11/Xos.h, this fragment appears:
-
- #ifdef SYSV
- #ifndef sgi
- #include <string.h>
- #define index strchr
- #define rindex strrchr
- #else
- #include <strings.h>
- #endif
- #else
- #include <strings.h>
- #endif /* SYSV */
-
- If "-ansi" is used during compilation, "sgi" is not defined, though
- "__sgi" is defined. "SYSV" should be defined. "index" is arbitrarily
- changed to "strchr" even though both index and strchr are available in
- SGI's libraries. If you happen to have a structure with an element
- named index, the element may occasionally be renamed strchr, causing
- compilation problems. Clearly this should be changed to "#ifndef
- __sgi".
-
- In Intrinsic.h, this fragment appears:
-
- #ifdef FUNCPROTO
- #undef NeedFunctionPrototypes
- #define NeedFunctionPrototypes 1
- #ifdef sgi
- #undef NeedWidePrototypes
- #define NeedWidePrototypes 0
- #endif /* sgi */
- #else
- #undef NeedFunctionPrototypes
- #define NeedFunctionPrototypes 0
- #undef NeedWidePrototypes
- #define NeedWidePrototypes 0
- #endif
-
- If "-ansi" is used, NeedFunctionPrototypes is set to 0, since "sgi" is
- not defined. Therefore function prototypes are not used.
-
- In ProtocolsP.h, this appears:
-
- typedef struct _XmProtocolClassPart{
- XtPointer extension;
- #ifdef sgi
- /* Allow future extensions without breaking shared library compatibility */
- caddr_t _SG_vendorExtension;
- #endif /* sgi */
- }XmProtocolClassPart;
-
- The structure XmProtocolClassPart is defined differently depending
- upon when "-ansi" is used. This is not desirable.
- Similarly with XmProtocolPart later in the same file.
-
- In resolv.h, _PATH_RESCONF is incorrectly defined if "-ansi" is used.
- scnhdr.h incorrectly uses "#ifdef sgi".
-
- In sys/socket.h, many socket function are undefined when "-ansi" is
- used. As far as I know accept is compatible with ansi c.
-
- There are many other header files that have this problem. The header
- files need to be rewritten.
-
-
-
-
- In addition there are problems with the use of __STDC__. I have been
- informed that the next release of Irix will by default defined
- __STDC__ even when "-ansi" is not used.
-
- In stdio.h, remove and rename are undefined when __STDC__ is undefined.
-
- In Intrinsic.h, this fragment occurs:
-
- #ifdef __STDC__
- typedef void* XtPointer;
- #else
- typedef char* XtPointer;
- #endif
-
- Clearly, "void *" is preferable to "char *" even if the compiler is
- not strictly ansi.
-
-
-
-
- There are other cases of both types of errors. The second type will
- be handled by the next release. I have hopes that SGI
- will finally correct the first problem during that release.
- --
- Kevin Dalley
- Toshiba America MRI, Inc.
- kevin@tamri.com
-