On 24-Jul-97, Christian S. Pedersen wrote to All about Conversion of
inter..
CSP> int* test()
CSP> {
CSP> int i=5;
CSP> return &i;
CSP> }
CSP> Why do I get a "Suspicious pointer conversion"-warning ? The functions
CSP> using this concept seems to work OK. Should I make them differently.
There's a problem there, though... you're returning a local var's
address, but right after the return, you'll be back out of i's scope, so
there's no more 5 there... you shoul make 5 static, or return by value
or reference (I'm not sure about this one) instead of by address.
Javier Kohen [The_Crusher] http://jkohen.base.org
... Linux, the choice of a GNU generation.
-!- CrusherTag 0.3.2.
--- Terminate 4.00/Pro
---------------
* Origin: The King of The Ring (4:900/748.3)
|