Topic: Question about casting


Author: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Date: Sat, 7 Jan 1995 18:50:12 GMT
Raw View
mlg@scr.siemens.com (Michael Greenberg) writes:

>For any type (that doesn't overload operator&), are the following
>expressions equivalent?

>   *((my_type*) &foobar)
>
>and
>
>    (my_type&) foobar

Yes.

>Is it always true for basic types (i.e. int)

Yes.


--
Fergus Henderson - fjh@munta.cs.mu.oz.au




Author: mlg@scr.siemens.com (Michael Greenberg)
Date: Tue, 3 Jan 1995 19:28:45 GMT
Raw View
For any type (that doesn't overload operator&), are the following
expressions equivalent?  If not, when?  Is it always true for basic
types (i.e. int)

   *((my_type*) &foobar)

and

    (my_type&) foobar

Thanks,





--
Michael Greenberg                      email: mgreenberg@scr.siemens.com
Siemens Corporate Research             phone: 609-734-3347
755 College Road East                  fax: 609-734-6565
Princeton, NJ 08540