From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2006-03-08 05:01:17
[mailto:boost-bounces_at_[hidden]] On Behalf Of Andy Little Sent:
08 March 2006 03:42 To: boost_at_[hidden]
Subject: Re: [boost] [bitfield] Initial bitfield proposal available
> "Emile Cormier" wrote
>> Martin is on to something about using pointers.
I'm not sure I am. I was trying to explain (and failing) why structs
may be larger than their embedded data. (By making the struct larger,
the pointer can be smaller).
> Surely any pointer must be capable of being converted to a void*
> which means void* has to know about the extra bits? How does that
sizeof(struct*) <= sizeof(void*)
Note that if you cast an unsigned char* to an arbitrary struct* and
back, you are **NOT** guaranteed to get your original pointer back. On
the other hand you are guaranteed that casting an arbitrary pointer to
struct to another pointer to struct and back will return you the
> I would have thought it would be possible to reinterpret_cast (or
> convert) the struct to the inbuilt type in these situations isnt it
> thus fooling
> the compiler into storing that type?
> The problem I see is that there seems to be two types of pointers
> here which doesnt seem to be standard C++ behaviour?
It is, oh it is!
-- Martin Bonner Martin.Bonner_at_[hidden] Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ, ENGLAND Tel: +44 (0)1223 203894
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk