Re: [boost] dangerous_cast<>

2002-12-09 Thread Anthony Williams
Gabriel Dos Reis writes: > > Hi, > > Anthony Williams <[EMAIL PROTECTED]> writes: > > [...] > > | > You made youself clear. > | > > | > However, there are two running issues originating from a claim of Dave > | > that dangerous_cast<> might be better than reinterpret_cast<> in

Re: [boost] dangerous_cast<>

2002-12-07 Thread Gabriel Dos Reis
Hi, Anthony Williams <[EMAIL PROTECTED]> writes: [...] | > You made youself clear. | > | > However, there are two running issues originating from a claim of Dave | > that dangerous_cast<> might be better than reinterpret_cast<> in | > casting from U* to T* (dangerous_cast<> uses the inter

Re: [boost] dangerous_cast<>

2002-12-05 Thread Anthony Williams
Gabriel Dos Reis writes: > Anthony Williams <[EMAIL PROTECTED]> writes: > > | > Anthony Williams <[EMAIL PROTECTED]> writes: > | > > | > [...] > | > > | > | 3.10p15: > | > | "If a program attempts to access the stored value of an object through an > | > | lvalue of other than

Re: [boost] dangerous_cast<>

2002-12-05 Thread Gabriel Dos Reis
Anthony Williams <[EMAIL PROTECTED]> writes: | > Anthony Williams <[EMAIL PROTECTED]> writes: | > | > [...] | > | > | 3.10p15: | > | "If a program attempts to access the stored value of an object through an | > | lvalue of other than one of the following types the behavior is undefine

Re: [boost] dangerous_cast<>

2002-12-05 Thread Anthony Williams
Gabriel Dos Reis writes: > Hi, Hi > Anthony Williams <[EMAIL PROTECTED]> writes: > > [...] > > | 3.10p15: > | "If a program attempts to access the stored value of an object through an > | lvalue of other than one of the following types the behavior is undefined: > | > | - the d

Re: [boost] dangerous_cast<>

2002-12-05 Thread Gabriel Dos Reis
Hi, Anthony Williams <[EMAIL PROTECTED]> writes: [...] | 3.10p15: | "If a program attempts to access the stored value of an object through an | lvalue of other than one of the following types the behavior is undefined: | | - the dynamic type of the object, | | ... | | - a char or u

Re: [boost] dangerous_cast<>

2002-12-05 Thread Anthony Williams
Gabriel Dos Reis writes: > "Peter Dimov" <[EMAIL PROTECTED]> writes: > > | From: "Gabriel Dos Reis" <[EMAIL PROTECTED]> > | > David Abrahams <[EMAIL PROTECTED]> writes: > | > > | > | Gabriel Dos Reis <[EMAIL PROTECTED]> writes: > | > | > | > | > Hmm, I have a couple of questions answers to

Re: [boost] dangerous_cast<>

2002-12-04 Thread Gabriel Dos Reis
"Peter Dimov" <[EMAIL PROTECTED]> writes: | From: "Gabriel Dos Reis" <[EMAIL PROTECTED]> | > David Abrahams <[EMAIL PROTECTED]> writes: | > | > | Gabriel Dos Reis <[EMAIL PROTECTED]> writes: | > | | > | > Hmm, I have a couple of questions answers to which will help me | > | > get your point. | > |

Re: [boost] dangerous_cast<>

2002-12-04 Thread Peter Dimov
From: "Gabriel Dos Reis" <[EMAIL PROTECTED]> > David Abrahams <[EMAIL PROTECTED]> writes: > > | Gabriel Dos Reis <[EMAIL PROTECTED]> writes: > | > | > Hmm, I have a couple of questions answers to which will help me > | > get your point. > | > > | > 1) Why can't you do that with reinterpret_cast? >

Re: [boost] dangerous_cast<>

2002-12-04 Thread Gabriel Dos Reis
Terje Slettebø <[EMAIL PROTECTED]> writes: | >From: "Gabriel Dos Reis" <[EMAIL PROTECTED]> | | > Terje Slettebø <[EMAIL PROTECTED]> writes: | > | > | >From: "Terje Slettebø" <[EMAIL PROTECTED]> | > | | > | > >From: "David Abrahams" <[EMAIL PROTECTED]> | > | > | > | > > Gabriel Dos Reis <[EMAIL PR

Re: [boost] dangerous_cast<>

2002-12-04 Thread Gabriel Dos Reis
David Abrahams <[EMAIL PROTECTED]> writes: | Gabriel Dos Reis <[EMAIL PROTECTED]> writes: | | > Hmm, I have a couple of questions answers to which will help me | > get your point. | > | > 1) Why can't you do that with reinterpret_cast? | | You can, but the results are non-portable No more non-

Re: [boost] dangerous_cast<>

2002-12-04 Thread Terje Slettebø
>From: "Gabriel Dos Reis" <[EMAIL PROTECTED]> > Terje Slettebø <[EMAIL PROTECTED]> writes: > > | >From: "Terje Slettebø" <[EMAIL PROTECTED]> > | > | > >From: "David Abrahams" <[EMAIL PROTECTED]> > | > > | > > Gabriel Dos Reis <[EMAIL PROTECTED]> writes: > | > > > | > > > Is it any different from r

Re: [boost] dangerous_cast<>

2002-12-04 Thread David Abrahams
Gabriel Dos Reis <[EMAIL PROTECTED]> writes: > Hmm, I have a couple of questions answers to which will help me > get your point. > > 1) Why can't you do that with reinterpret_cast? You can, but the results are non-portable > 2) Why is that supposed to be better than reinterpret_cast<>? The re

Re: [boost] dangerous_cast<>

2002-12-04 Thread Gabriel Dos Reis
Terje Slettebø <[EMAIL PROTECTED]> writes: | >From: "Terje Slettebø" <[EMAIL PROTECTED]> | | > >From: "David Abrahams" <[EMAIL PROTECTED]> | > | > > Gabriel Dos Reis <[EMAIL PROTECTED]> writes: | > > | > > > Is it any different from reinterpret_cast(p) ? | > > | > > It might be, depending on your

Re: [boost] dangerous_cast<>

2002-12-04 Thread Gabriel Dos Reis
David Abrahams <[EMAIL PROTECTED]> writes: | Gabriel Dos Reis <[EMAIL PROTECTED]> writes: | | > David Abrahams <[EMAIL PROTECTED]> writes: | > | > | Gabriel Dos Reis <[EMAIL PROTECTED]> writes: | > | | > | > "David B. Held" <[EMAIL PROTECTED]> writes: | > | > | > | > | Does this have any merit w

Re: [boost] dangerous_cast<>

2002-12-04 Thread David Abrahams
Gabriel Dos Reis <[EMAIL PROTECTED]> writes: > David Abrahams <[EMAIL PROTECTED]> writes: > > | Gabriel Dos Reis <[EMAIL PROTECTED]> writes: > | > | > "David B. Held" <[EMAIL PROTECTED]> writes: > | > > | > | Does this have any merit whatsoever? > | > | > | > | template > | > | T* dangerous_cas

Re: [boost] dangerous_cast<>

2002-12-04 Thread Terje Slettebø
>From: "Terje Slettebø" <[EMAIL PROTECTED]> > >From: "David Abrahams" <[EMAIL PROTECTED]> > > > Gabriel Dos Reis <[EMAIL PROTECTED]> writes: > > > > > Is it any different from reinterpret_cast(p) ? > > > > It might be, depending on your compiler. The behavior of > > reinterpret_cast is implementat

Re: [boost] dangerous_cast<>

2002-12-04 Thread Terje Slettebø
>From: "David Abrahams" <[EMAIL PROTECTED]> > Gabriel Dos Reis <[EMAIL PROTECTED]> writes: > > > "David B. Held" <[EMAIL PROTECTED]> writes: > > > > | Does this have any merit whatsoever? > > | > > | template > > | T* dangerous_cast(U* p) > > | { > > | return static_cast(static_cast(p)); > >

Re: [boost] dangerous_cast<>

2002-12-04 Thread Gabriel Dos Reis
David Abrahams <[EMAIL PROTECTED]> writes: | Gabriel Dos Reis <[EMAIL PROTECTED]> writes: | | > "David B. Held" <[EMAIL PROTECTED]> writes: | > | > | Does this have any merit whatsoever? | > | | > | template | > | T* dangerous_cast(U* p) | > | { | > | return static_cast(static_cast(p)); | >

Re: [boost] dangerous_cast<>

2002-12-04 Thread David Abrahams
Gabriel Dos Reis <[EMAIL PROTECTED]> writes: > "David B. Held" <[EMAIL PROTECTED]> writes: > > | Does this have any merit whatsoever? > | > | template > | T* dangerous_cast(U* p) > | { > | return static_cast(static_cast(p)); > | } > > Is it any different from reinterpret_cast(p) ? It might

Re: [boost] dangerous_cast<>

2002-12-04 Thread Gabriel Dos Reis
"David B. Held" <[EMAIL PROTECTED]> writes: | Does this have any merit whatsoever? | | template | T* dangerous_cast(U* p) | { | return static_cast(static_cast(p)); | } Is it any different from reinterpret_cast(p) ? -- Gaby ___ Unsubscribe & other

Re: [boost] dangerous_cast<>

2002-12-04 Thread David Abrahams
"David B. Held" <[EMAIL PROTECTED]> writes: > Does this have any merit whatsoever? > > template > T* dangerous_cast(U* p) > { > return static_cast(static_cast(p)); > } > > Obviously, you only use it when you know the binary layout of some > object(s) and no other cast produces defined or reli

[boost] dangerous_cast<>

2002-12-03 Thread David B. Held
Does this have any merit whatsoever? template T* dangerous_cast(U* p) { return static_cast(static_cast(p)); } Obviously, you only use it when you know the binary layout of some object(s) and no other cast produces defined or reliable behaviour. Of course, I'm not sure this produces either of