comp.lang.c
[Top] [All Lists]

Re: void * vs. T *

Subject: Re: void * vs. T *
From: Richard Heathfield
Date: Fri, 28 Mar 2008 18:55:57 +0000
Newsgroups: comp.lang.c

CBFalconer said:

> Keith Thompson wrote:
>> CBFalconer <cbfalconer@xxxxxxxxx> writes:
>>> lawrence.jones@xxxxxxxxxxx wrote:
>>>> santosh <santosh.k83@xxxxxxxxx> wrote:
>>>>>
>>>>> I know of no platforms where different pointer types are
>>>>> different, let alone perversions worthy of the DS9k.
>>>>
>>>> Crays (and other word-addressed machines) have a different
>>>> representation for char * and void * than other pointers due to
>>>> the need to keep an offset within the word in addition to the
>>>> address of the word.
>>>
>>> Are you sure of that?
>> 
>> He probably is.  I know I am, since I've worked on such machines.
>> 
>>>             That is contrary to the C standard.
>> 
>> No it isn't.  char*, unsigned char*, signed char*, and void* are
>> required to have the same representation as each other (perhaps
>> that's what caused your confusion), but they're not required to
>> have the same representation, or even the same size, as other
>> pointer types.
> 
> Read the quote again.  He is referring specifically to void* and
> char*.  Not to any other type of pointer.  At least as I read it,
> on rereading I can see a misunderstanding possibility.

You misread. He is saying that the representation, on Crays (and other 
word-addressed machines), of (char * and void *) is different to that of 
(other pointer types). That's perfectly legal.

-- 
Richard Heathfield <http://www.cpax.org.uk>
Email: -                                www">http://www. +rjh@
Google users: <                                www.cpax.org.uk/prg/writings/googly.php">http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy