On Wed, Apr 09, 2003 at 11:57:37PM -0700, Marc Singer wrote:
>   func_b (&(void*)pa);

> So, is this simply an example of the compiler failing to warn?

Yes. When you cast something, the compiler can do many things: covert the
value and put it in a register (in which case you can't take the address
of it), convert the value and put it somewhere more convenient in memory
(in which case you can, but if you write to it, it'll be lost), or just
use the existing location if no conversion is strictly required.

You should be getting an error like:

  test.c:13: invalid lvalue in unary `&'

(which is what I get when I build with gcc-3.2, not g++-3.2). Unless of
course this is another little divergence of C++.

Cheers,
aj

-- 
Anthony Towns <[EMAIL PROTECTED]> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. GPG signed mail preferred.

  ``Dear Anthony Towns: [...] Congratulations -- 
        you are now certified as a Red Hat Certified Engineer!''


Reply via email to