[slang-users] wrong predeclaration makes function unaccessable
Jörg Sommer
joerg at alea.gnuu.de
Tue Jan 9 17:50:46 EST 2007
Hallo John,
"John E. Davis" <davis at space.mit.edu> wrote:
> =?UTF-8?Q?J=C3=B6rg?= Sommer <joerg at alea.gnuu.de> wrote:
>>
>>#v+
>>implements("gaga");
>>
>>static define foo(); % wrong behaviour
>>% private define foo(); % correct behaviour
>>
>>static define bla()
>>{
>> foo();
>>}
>
> When "bla" gets compiled, the only version of "foo" that is available
> is the one that exists in the static namespace. Hence it is the one
> that gets linked to "bla". And because the body of the function does
> not exist, the function will do nothing when called.
When you say the static function has an empty body this should be
equivalent to the definition above:
static define foo() {}
But this gives an error. I think, SLang should complain about the
previous definition of foo() with a different modifier as it does if the
functions have bodies.
Bye, Jörg.
--
Der Mensch hat die Atombombe erfunden.
Keine Maus der Welt käme auf die Idee, eine Mausefalle zu konstruieren.
More information about the slang-users-l
mailing list