[Gc] returning stack address without a warning
Eric.Deplagne at wanadoo.fr
Thu Oct 26 04:12:09 PDT 2006
On Thu, 26 Oct 2006 11:33:20 +0100, Andrew Haley wrote:
> Eric Deplagne writes:
> > > 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...
> No, that's a bad idea. Later versions of the compiler may well see
> through this trick and you'll get the warning again. It is better
> either to use a properly supported way to the the stack address or to
> live with the warning than to go through such contortions.
Well... The first part of your "or" statement is obviouly false,
there is no supported way to get the stack address...
As for a compiler noticing this trick, it might happen, but I really
doubt it, as long as the helper function doesn't get inlined...
IMHO one more function away is not such a "contortion" that it's not worth it...
And for the case a compiler was clever enough to still bark, I guess I would then
cope with the warning, having done what is possible to avoid it...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : https://napali.hpl.hp.com/pipermail/gc/attachments/20061026/d3b59e77/attachment-0001.pgp
More information about the Gc