f-981229-29

ldmud-3.2.9/src/bugs/f-981229-29 · 962 B

From the archive ldmud-329.tar.gz

Download the archive   « Back to the archive contents

Short: References MudOS vs. Amylaar
Date: Mon, 21 Dec 1998 20:08:04 +0200 (EET)
Type: Feature
State: Unclassified

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

Site Stats

Snippets: 1791
Codebases: 571