>From: Surya Pratik Saha <spsaha@cal.interrasystems.com> >If a ref variable initialized at the time of declaration, will it be treated as >procedural assignment? ... >What will be the behaviour for the following test case? >module xx; > function int f(ref int x = 1); > return x; > endfunction That is not an initializer. That is a default argument value to be passed if the caller does not supply one. This code is also illegal. A constant is not a legal value to pass by reference, so this is not a legal default value for a ref argument. There is no way to apply an initializer to a ref argument, so your question doesn't make sense. Also, a function with a ref argument must be automatic, so a ref argument is always automatic. This means that hierarchical references to ref arguments are illegal. So your reference to f.x is illegal. As an automatic, the ref argument does not exist, and does not have a value, before it is called. When the function is called, the ref argument is created and initialized to refer to the actual argument passed. That is the only way it is ever initialized. Steven Sharp sharp@cadence.comReceived on Thu Nov 10 16:22:12 2005
This archive was generated by hypermail 2.1.8 : Thu Nov 10 2005 - 16:22:47 PST