[Gc] returning stack address without a warning
Eric.Deplagne at wanadoo.fr
Thu Oct 26 00:13:58 PDT 2006
> My goal with -Wall and similar is to at least document any remaining
> warnings in the source. The collector inherently does a few things that
> should generate warnings in "normal" code, e.g. it returns the address
> of a local to get an upper bound on the stack pointer. This also really
> applies only to gc7.
If there's nothing clever I didn't notice on the way, using an helper
function is enough to prevent the compiler from noticing what we're doing
to that poor local variable...
/* this warns about returning the address of a local variable */
return (void *)&p;
void *stackptr_v2_helper(void *p)
/* this should not warn */
/* should give twice the same value */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://napali.hpl.hp.com/pipermail/gc/attachments/20061026/4b7b7693/attachment.pgp
More information about the Gc