TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Daniel Doran
from: Paul Edwards
date: 1995-10-26 08:19:12
subject: ANSI C

DD>  1: //              -- C++ comment
DD>  2: void main(      -- int main( is the ANSI standard
DD>  3: , char **envp   -- 3 arguments for main() is a System V Unix 
DD> convention, but
DD>                        I have yet to see a C compiler that doesn't support 
DD> it.

I'm pretty sure IBM C/370 V2.0 didn't support it, depending on
what you call "support".  It is likely you can add an extra 5
parameters to the end of main, with very few if any compilers
actually giving you a compile *error*.

DD> Just curious, but do you know if ANSI C accepts the following variable
DD> definition, and if so, is the definition likely to be portable between
DD> big-endian and little-endian processors:

DD>  int zees='Zz';

DD> I've seen some compilers accept it, and others that did not.

You can get a copy of the ANSI C draft (same as the standard AFAIK)
by FREQing ANSI_C.* from 3:711/934.  I don't actually know the 
answer myself, but on looking it up, I would say that that is
implementation-defined, ie a conforming compiler could set the 
above value to "0", "5" or "32767" if it wanted to.

Interestingly I could find nothing that restricts the length you
can specify there, e.g. you could go

int zees = 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ';

and I can't see anything that would allow the compiler to treat that
as an error.

The reference that I looked at was ISO 6.1.3.4, which says "The value
of an integer character constant containing more than one character,
or containing ... is implementation-defined".  BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.