[sv-bc] Function call without parenthesis

From: Surya Pratik Saha <spsaha_at_.....>
Date: Wed Dec 14 2005 - 05:57:21 PST
In IEEE Std 1800 SV LRM, section 12.4.5 (page no. 160), it is specified:
[...]
12.4.5 Optional argument list
When a void function or class function method specifies no arguments, the empty
parenthesis, (), following
the subroutine name shall be optional. This is also true for tasks, void
functions, and class methods that
require arguments, when all arguments have defaults specified. It shall be
illegal to omit the parenthesis in a
directly recursive nonvoid function method call that is not hierarchically
qualified.
[...]

For the following cases, my understanding is as follows:
1) voidfunction; // voidfunction is a void function, so no parenthesis is
                 // required. Correct behaviour

2) x = c.func; // func is member function of class object c, correct behaviour

3) x = top.func; // func is defined inside a module top; incorrect behaviour,
             // you need to specify parenthesis.

4) x = str.len; // len is method of string datatype, incorrect behaviour,
            // you need to specify parenthesis.

5) x = func; // func is defined locally as non void function; incorrect
             // behaviour, you need to specify parenthesis.

Please let me know whether my understanding correct or not.

Also please let me know why the parenthesis restriction is removed only for
class methods, not for other hierarchical reference. As it is very difficult to
distinguish between a class method call and normal hierarchical reference at the
time of compilation.

Regards
Surya.
Received on Wed Dec 14 05:52:51 2005

This archive was generated by hypermail 2.1.8 : Wed Dec 14 2005 - 05:54:23 PST