View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000173||LDMud||LPC Compiler/Preprocessor||public||2004-11-26 22:14||2004-11-26 22:14|
|Summary||0000173: MudOS references vs. LDMud references|
|Description||Short: References MudOS vs. Amylaar|
Date: Mon, 21 Dec 1998 20:08:04 +0200 (EET)
The MudOS way of specifying reference arguments in the function signatures
make more sense than the Amylaar way of modifying the actual arguments.
Beek gives a good reason:
> Amylaar pass-by-reference is a real kludge, which is why it works
> differently in MudOS: consider the fact that you can expose internal
> modifications of function arguments by passing a reference to a
> function that didn't expect one! That's certainly wierd, and possibly
> even a security problem in poorly code functions ...
It can be argued if requiring the 'ref' in the function call is a good
thing or not, but it is a reminder to the programmer.
It can even be used to pass constant variables/literals for such arguments:
void foo(ref int x);
foo(5) -> GD creates a temporary int, assigns 5 and passes it as argument
foo(ref 5) -> compile-time error
|Tags||No tags attached.|
|External Data (URL)|