From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,df854b5838c3e14 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,df854b5838c3e14 X-Google-Attributes: gid103376,public X-Google-Thread: 10db24,fec75f150a0d78f5 X-Google-Attributes: gid10db24,public X-Google-Thread: 1014db,df854b5838c3e14 X-Google-Attributes: gid1014db,public From: seebs@solutions.solon.com (Peter Seebach) Subject: Re: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada) Date: 1996/04/09 Message-ID: <4kdl00$rv@solutions.solon.com>#1/1 X-Deja-AN: 146532390 references: <4kb2j8$an0@solutions.solon.com> <4kbrt5$k3h@mulga.cs.mu.OZ.AU> organization: Usenet Fact Police (Undercover) reply-to: seebs@solon.com newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.edu Date: 1996-04-09T00:00:00+00:00 List-Id: In article , Robert Dewar wrote: >By a "portability problem" most people mean that you take a program >written in language X, and try to move it to machine Y from machine Z, >and it does not work any more. Right. No behavior of "i=++i", or of someone twiddling the internals of a stdio FILE, can be unportable, because no program doing those is written in C. They are portability problems of the language "incorrect C", which is beyond the intended scope of comp.lang.c. :) Really; any time you are writing things not specified in any spec, you have left the realm of what that spec guarantees, and nothing that happens to you is a portability problem with that spec. It may be a weakness problem with that spec; C's spec is certainly too weak in some areas. But it's possible to implement it on nearly anything, which was the goal. >Portability problems are most definitely caused by writing non-portable >code. In fact in the absence of errors in the compiler of environment >on machine Y or machine Z, this is the ONLY source of portability >problems. This, we agree on, mostly... >However, it is definitely the case that languages vary in the ease with >which people end up writing non-portable code deliberately or >accidentally. Also very true. I believe it is basically impossible to meaningfully write portable machine code. (Exceptions exist; there was a program in the IOCCC which worked on a VAX *or* a PDP.) >For example, in C, we can't declare an integer variable without >introducing a potential portability dpeendence on the range. Careful >writing can get around this, or certainly minimize it, but it's often >the source of porability problems. Typical Ada prograns do not suffer >from this particular problem, because even a novice Ada programmer >knows to avoid the use of predefined types in code that is intended >to be portable. This is a known limitation of C, and may be addressed by C9X. I hope it is; it's one of the few areas where I feel the language is fundementally incapable of doing what I want it to do. Luckily, it doesn't affect most of what I'm working on these days. -s -- Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach. C/Unix wizard -- C/Unix questions? Send mail for help. No, really! FUCK the communications decency act. Goddamned government. [literally.] The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html