[mod.std.c] mod.std.c Digest V13#2

osd@hou2d.UUCP (Orlando Sotomayor-Diaz) (01/17/86)

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


mod.std.c Digest            Fri, 17 Jan 86       Volume 13 : Issue   2

Today's Topics:
                         Subtracting (void *)  (2 msgs)
                             type of '%'
----------------------------------------------------------------------

Date: Wed, 15 Jan 86 02:08:22 est
From: ihnp4!seismo!hadron!jsdy (Joseph S. D. Yao)
Subject: Subtracting (void *)
To: ihnp4!hou2d!osd

In my mental model, where sizeof(char) tends to be 1 and sizeof(short
int) tends to be 2, I think of sizeof(void) as 0.  The strict mathe-
matical extension of this is that the difference between two such is
undefined, or infinite.  This is reasonable if you are treating a
void pointer as a true pointer to nothing: the difference between two
pointers to nothing must be undefined.  As it is, it is interpreted
as a PTR data type, or pointer to anything.  Well, as such the
difference appears to be still undefined.
-- 

	Joe Yao		hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}

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

Date: Thu, 16 Jan 86 20:10:14 EST
From: Doug Gwyn (VLD/VMB) <gwyn@BRL.ARPA>
Subject: Subtracting (void *)s
To: std-c%cbosgd.uucp@brl-vgr.arpa

My interpretation is that a (void *) does not point at anything
(not even a 0-sized "thing"), and therefore you are not allowed
to perform arithmetic on it.  The only thing it's good for is
as a generic holder for pointers of any type.

[ I'd suggest to state this explicitly on the standard. - Mod - ]

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

Date: Tue, 14 Jan 86 09:53:22 est
From: cbnap!whp
Subject: type of '%'
To: cbosgd!std-c

>from Arnold Robbins <gatech!arnold>
>...
>The constant '%' is of type char, ...

Maybe in the draft it says its of type char, but on existing implementations
the type of '%' is int (according to AT&T C language definition as of
April '84; the C reference manual in the back of K&R doesn't say what the
type is).  Certainly The type can't be char on any machine with a larger
word size, since constants such as 'ab' (or even 'abcd' on some machines)
are allowed.  (Perhaps the draft doesn't mention multi-character constants
since they're inherently non-portable.)

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

End of mod.std.c Digest - Fri, 17 Jan 86 08:19:57 EST
******************************
USENET -> posting only through cbosgd!std-c.
ARPA -> ... through cbosgd!std-c@BERKELEY.ARPA (NOT to INFO-C)
In all cases, you may also reply to the author(s) above.