> Or, looking at it from a different angle, why are you NOT surprised that you
> can do this in C?
>
> myfunction("Literal string: omg no variable!");

Hmm... a good concise example. Thanks, Mike. :)



>> I'm just curious how FB manages this without corrupting memory. It
>> seems like such a weird design choice.
>
> Consider this. In QB, everything was BYREF by default. So, this had to be
> legal:
>
> sub mysub(myparam as integer)
>    REM whatever
> end sub
>
> mysub 1
>
> If it weren't legal, you'd get an error on a seemingly standard BASIC
> program.

I can appreciate that "that's the way it's always been", and I'm sure
that it's much easier to use once you're used to it.

But it still makes me feel uneasy. What if you save that variable into
some global variable, then exit the function? The copy on the stack no
longer exists, so the global var is now pointing to random stack data.
(I realize that copying the VALUE into the global var fixes this in
the simple case.) If I see "BYREF", I'd like to think that data exists
somewhere non-transient.

That last paragraph is really just my own feelings on design; I'm
otherwise convinced that BYREF on constant data is reasonable. :)

-->Seth
_______________________________________________
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to