Article View: net.lang.c
Article #9196Re: Using strings as immediate char
From: Cesar Quiroz
Date: Mon, 25 Aug 1986 04:34
Date: Mon, 25 Aug 1986 04:34
43 lines
2520 bytes
2520 bytes
Expires:
Sender:
Followup-To:
In a recent posting, referring to the "abc"[2] question:
>> sun!guy (Guy Harris) writes:
>> >(The real test, of course, is whether
>> > cmdchr = menu_selection["rofq"];
>> >yields the same result. Any compiler that doesn't produce
>> >object code that yields the same result isn't a C compiler.)
>>
To which karl@haddock replied asking why should it be so, and
suggested making it illegal, among other reasons because, presumably
>> ... It makes it easier to define
>> arrays as a real datatype in future implementations if "x[y]" is
>> redefined slightly.
Please notice that "future implementations" always have to
decide whether they want to be reasonably compatible with the
language as it is. The identity x[y] = *(x+y) is so substantial to
C as it is now, that an implementation that invalidated it would
have trouble with *lots* of reasonable current code. For the sake
of argument, we can imagine calling our 'foo x[];' things something
like vectors (as C++ does) and then inventing real arrays (as you
want them). Then if the real arrays don't obey the identity above,
we better introduce new syntax, so most old programs are still valid
and *have the same meaning*, while some legal new programs (the ones
that depend on the extension) are distinguishably illegal in the Old
Standard. I don't think it pays to patch C even more, but at least
let's try for extensions that don't cause trouble.
Anybody for 'char txt]100[;' as the new syntax? :-) That's more or
less what I had in mind. No way to confuse them. (Or there is?)
--
Cesar Augusto Quiroz Gonzalez
Department of Computer Science {allegra|seismo}!rochester!quiroz
University of Rochester or
Rochester, NY 14627 quiroz@ROCHESTER
Technical Details
Message-ID:
<20382@rochester.ARPA>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rochester!quirozReferences:
<6309@sun.uucp> <86900026@haddock>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rochester!quiroz From: quiroz@rochester.ARPA (Cesar Quiroz) Newsgroups: net.lang.c Subject: Re: Using strings as immediate char Message-ID: <20382@rochester.ARPA> Date: Mon, 25-Aug-86 00:34:26 EDT Article-I.D.: rocheste.20382 Posted: Mon Aug 25 00:34:26 1986 Date-Received: Mon, 25-Aug-86 03:04:08 EDT References: <6309@sun.uucp> <86900026@haddock> Reply-To: quiroz@rochester.UUCP (Cesar Quiroz) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 36 Summary: "Future Implementations" is no excuse. K&R App 7.1 is law here. Emacs: -*- Mode: subMH -*-