On 9/12/2010 10:31 PM, Seth Hetu wrote:
I have a feeling that this should be illegal in FB. I could totally see FB forgetting that it stored a variable in its nondeclared variable storage and overwriting it in a later function.I'd definitely avoid this situation with gusto. Consider passing '3' (just the number) as "by ref" into the parameter 'x' ---what happens if the compiler inlines that variable, copying it to each place the variable is used inside the function? That becomes problematic for, e.g.,: x = 10 ....which becomes: 3 = 10 That, at least, is the reason it's illegal in C++ ---not sure what the FB compiler says if you try this. (Of course, in early Fortran dialects, side-effecting 3 to 10 was completely possible... but that's a whole different can of worms (and I've been told it doesn't work in newer compilers).)
I imagine that any sane compiler would turn that situation into this: dim temp as integer = 3 byrefsub(temp)
-->Seth _______________________________________________ Ohrrpgce mailing list [email protected] http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
_______________________________________________ Ohrrpgce mailing list [email protected] http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
