|
Boost : |
From: Richard Damon (rdamon_at_[hidden])
Date: 2001-06-13 16:42:10
Start with a DSP chip with 16 bit words, and all addressing was based on
word. I.E. and address of n+1 pointer to 1 word (16 bits) higher in memory
the an address of n. Thus a pointer to int could be a native address. If now
you wanted to support access to an eight bit byte as part of a word, then a
char* (and thus a void*) must contain additional information to indicate
which byte in the word to use. Byte access my cause the compiler to generate
additional code to select the appropriate byte. Because of this possibility
the standard does force all pointers to have the same size. It does require
that a round trip through void* must not lose information. My understanding
is that there were several machines like this in use when the C standard was
being worked on. Yes a number of programmers ignore this because they are
used to working only on byte addressable machines where all pointers look
the same.
-- Redirector to current best: Richard_Damon_at_[hidden] Home: rbrdamon_at_[hidden] Work: rdamon_at_[hidden] -----Original Message----- From: deansturtevant_at_[hidden] [mailto:deansturtevant_at_[hidden]] Sent: Wednesday, June 13, 2001 4:36 PM To: boost_at_[hidden] Subject: [boost] Re: boost::nil Is that really true? sizeof(void*) > sizeof(int*) ? On what platform? Seems to me like that would break a lot of C/C++ code. --- In boost_at_y..., "Richard Damon" <rdamon_at_b...> wrote: > By the standard, Vararg functions need to have the null pointer constant > casted to the appropriate pointer type. On systems were all pointers are the > same size you have a better chance of getting away with an uncast NULL then > with 0, as vendors normally try to make it work if they can by using 0L if > that makes it the right size for a pointer, but this is not portable. On > word addressable machines sizeof(void*) > sizeof(int*) so to compiler can > not know at the call site what size null pointer constant to pass. > > -- > Redirector to current best: Richard_Damon_at_i... > Home: rbrdamon_at_r... > Work: rdamon_at_B... >
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk