On 09/06/12 13:34, Era Scarecrow wrote:
>  Alright let's go the opposite direction. Give me an example in which passing 
> a variable (by reference to a function) would EVER require it to check the 
> address to see if it was null. Class/allocated objects should fail before the 
> function gets control. ie:
> 
>  void func(ref int i);
> 
>  class X {
>    int i;
>  }
> 
>  X x;
>  int* i;
>  int[10] a;
> 
>  func(x.i); /*should fail while dereferencing x to access i,
>               so never gets to func*/
>  func(*i);  //does this count as a lvalue? Probably not,
>  func(a[0]);//none of these three should compile with that in mind
>  func(0);
> 
>  Being named variables, and likely non-classes you are then left with mostly 
> local variables, or arrays, or some type of pointer indirection issue. But 
> ever case I come up with says it would fail before the function was called.

Both '*i' and 'a[0]' count. (Even '0' could be made to work as a 'const ref'
arg, but i'm not sure if that would be a good idea)

artur

Reply via email to