home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sun.misc
- Path: sparky!uunet!cs.utexas.edu!wupost!emory!sol.ctr.columbia.edu!ira.uka.de!slsvaat!slsvitt!dcb
- From: dcb@slsvitt (David Binderman 3841)
- Subject: Re: Sun's ANSI C
- Message-ID: <1993Jan5.160212.2841@us-es.sel.de>
- Sender: news@us-es.sel.de
- Organization: SEL-Alcatel LTS Dept. US/ES
- X-Newsreader: TIN [version 1.1 PL8]
- References: <C04uHC.Bt2@news.cso.uiuc.edu>
- Date: Tue, 5 Jan 93 16:02:12 GMT
- Lines: 48
-
- David Swofford (swofford@uxh.cso.uiuc.edu) wrote:
- : alec@stortek.com (Alec Sharp - x2955) writes:
-
- : >We've been using the standard Sun C compiler on SunOS 4.1.x, and have just bought
- : >a copy of the ANSI compiler so that we can investigate moving to ANSI C. I tried
- : >compiling and linting some programs and noticed a problem with the function
- : >prototypes, some of which don't seem to conform to ANSI (I've included some examples
- : >below, with Sun's version first, then what I read as the ANSI standard).
-
- : >Has anyone else noticed this? If so, what did you do? If what I see is
- : >really what Sun produces, I'm rather disappointed with their quality control.
-
- : [Examples deleted]
-
- : On page 76-77 of the "Sun ANSI Programmer's Guide" is the following:
-
- : "Some of the functions in SunOS 4.1. libc do not behave as specified by the
- : ANSI standard. These differences are detailed below..." (the ones included
- : in your examples plus maybe a few others).
-
- : I was *FURIOUS* when I discovered this. I bought the compiler because it
- : was "Sun ANSI C". In the preface of the manual it says "Sun ANSI C is Sun's
- : ANSI-compliant compiler that runs on SunOS 4.1." But in the "Read this first"
- : section of the manual it says "Sun ANSI C is intended as a transition compiler
- : from Sun C to a fully compliant ANSI C". For most users, the differences
- : probably won't matter (e.g., who cares whether malloc returns a char*
- : or a void*, since it's almost always cast to something else anyway?). But
- : calling a compiler "ANSI-compliant" when some functions return totally
- : different kinds of values is ABSURD. The one that really got me was sprintf.
- : In my application, I need to format a string via sprintf and know how long the
- : resulting string is. ANSI requires sprintf to return an integer representing
- : the length of the formatted string, but in Sun's "ANSI" C, sprintf still
- : returns a char*. So I still have to do strlen calls after sprintf's, when I
- : should just be able to look at the sprintf return value, which uglies up the
- : code with #if SUN ... #else .... #endif constructs.
-
- : Does anyone know if the unbundled compiler being sold with Solaris 2.x is
- : fully ANSI-compliant?
- : --
- : David L. Swofford Phone: (217)244-6959
- : Illinois Natural History Survey FAX: (217)333-4949
- : 607 E. Peabody Drive BITNET: DAVESWOF@UIUCVMD
- : Champaign, Illinois 61820 USA Internet: swofford@uxh.cso.uiuc.edu
-
- --
- David C Binderman Dept US/ESI, Bau 60, SEL-Alcatel AG, Lorenz Strasse 10,
- D-7000 Stuttgart 40, Germany dcb@us-es.sel.de Tel: +49 711 821 3841
- An opinion for every occasion.
-