On Thursday 10 April 2003 08:57, Marc Singer wrote:
> int func_b (void** ppv)
> {
> *ppv = (void*) 2;
> return 0;
> }
>
>
> char* test (void)
> {
> char* pa = NULL;
> func_b (&(void*)pa);
creates a pointer-to-void, copies the value of pa into it and then takes the
address of that new obje
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
I've found that G++ 3.2 has a problem optimizing this code.
#include
int func_b (void** ppv)
{
*ppv = (void*) 2;
return 0;
}
char* test (void)
{
char* pa = NULL;
func_b (&(void*)pa);
return pa;
}
int main (int, char**)
{
char* p = NULL;
p = test ();
printf ("%p\n", p);
ret
3 matches
Mail list logo