mod.std.c Digest V8#6

Orlando Sotomayor-Diaz osd at hou2d.UUCP
Sat Jul 13 02:40:03 AEST 1985


From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>


mod.std.c Digest            Wed, 10 Jul 85       Volume 8 : Issue   6 

Today's Topics:
                               __ANSI__
                   conforming implementation [A.7]
                         macro names [D.1.2]
                        size 0 array? [C.5.3]
                           srand() [D.10.2]
                          trigraphs [B.2.1]
                        value of errno [D.1.1]
----------------------------------------------------------------------

Date: Sun, 7 Jul 85 16:42:42 EDT
From: seismo!elsie!ado
Subject: __ANSI__
To: std-c at cbosgd

For those of us who know how long it will take for the ANSI standard to wend
its way to all systems, might it be possible to persuade the standardizers
to augment the "__FILE__" and "__LINE__" predefined macros with an "__ANSI__"
predefined macro?  This would allow for code of the form

	#ifdef __ANSI__
		/* futuristic code */
	#endif
	#ifndef __ANSI__
		/* current code */
	#endif

--
	UUCP: ..decvax!seismo!elsie!ado    ARPA: elsie!ado at seismo.ARPA
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks

------------------------------

Date: Thu, 20 Jun 85 17:42:07 edt
From: John White <mcnc!jnw>
Subject: conforming implementation [A.7]
To: std-c at cbosgd

     In section A.7:
"A conforming hosted implementation must accept any strictly conforming
program."
     This is fine, but section B.1.1.3 adds:
"A conforming implementation must produce a diagnostic message for every
violation of a syntax rule or a constraint."
     I will agree that a compiler should always print an error message
if any error is encountered in the source that keeps the expected code
from being generated. But what if, due to the way its implemented, a
compiler has slightly less stict syntax than the standard requires and
produces reasonable code when given source using this syntax?
Adding checks for this situation would make the compiler bigger and slower.
Also, supose a compiler has an extention that is not allowed by some
syntax rule or constraint. Does documenting this extention exempt the
compiler from producing the diagnostics required by B.1.1.3?
(In all cases, assume the compiler meets A.7)

------------------------------

Date: Thu, 20 Jun 85 17:42:07 edt
From: John White <mcnc!jnw>
Subject: macro names [D.1.2]
To: std-c at cbosgd

     In section D.1.2:
"An implementation may define macros whose names begin with two or more
underscores, even if no headers are explicitly included."
     Why TWO underscores? Is there a reason, or is the standard just getting
underscore-happy? All names begining with one underscore are reserved,
so why can't an implementation define them?

------------------------------

Date: Thu, 20 Jun 85 17:42:07 edt
From: John White <mcnc!jnw>
Subject: size 0 array? [C.5.3]
To: std-c at cbosgd

     The standard states that, when declaring an array (C.5.3):
"The constant expression that specifies the size of an array must have
integral type and positive value."
     Why can't an array have 0 size? Is there some problem in writing
a compiler that allows this? I have encountered a need for this when
using an array of structures that contained 0 or more examples of an
object. I wanted to put in the examples and have the compiler use
sizeof to find out how many examples there were. (I had to have a
dummy example at the end so the compiler I was using would not complain
about an array of size 0).
     Another use is at the end of a structure where an array of size 0
could be declared. When mallocing memory, the size of the structure
could be added to the size of the desired array (0 to whatever).
Again, this could be fudged, but it wouldn't have to be fudged if arrays
of size 0 were allowed.

------------------------------

Date: Thu, 20 Jun 85 17:42:07 edt
From: John White <mcnc!jnw>
Subject: srand() [D.10.2]
To: std-c at cbosgd

     Section D.10.2 defines the rand() and srand() routines. But the
srand() routine only assigns its parameter to the static seed variable.
Some current implementations allow srand(-1) to set the seed using the
time-of-day. Is this an allowed extention?

------------------------------

Date: Thu, 20 Jun 85 17:42:07 edt
From: John White <mcnc!jnw>
Subject: trigraphs [B.2.1]
To: std-c at cbosgd

     Section B.2.1 seems to me to imply that all compilers are required
to accept trigraphs. Only implementations on machines that need trigraphs
should be required to suport them. It is easy to write a filter that
converts trigraph C to C, and from C to trigraph C. Anyone with a
trigraph C program on a regular machine could put the program through
such a filter.

------------------------------

Date: Thu, 20 Jun 85 17:42:07 edt
From: John White <mcnc!jnw>
Subject: value of errno [D.1.1]
To: std-c at cbosgd

     In section D.1.1:
"The value of errno may be set to non-zero by a library function call even
if there is no error, provided the use of errno is not documented in the
description of the function."
     Is this a typo?

------------------------------

End of mod.std.c Digest - Wed, 10 Jul 85 19:43:44 EDT
******************************
USENET -> posting only through cbosgd!std-c.
ARPA -> ... through cbosgd!std-c at BERKELEY.ARPA (NOT to INFO-C)
In all cases, you may also reply to the author(s) above.



More information about the Mod.std.c mailing list