Re: [sv-bc] Serious issue with default expressions for task and function arguments

From: Steven Sharp <sharp_at_.....>
Date: Fri Mar 04 2005 - 16:13:05 PST
If I understand the C++ situation correctly, a compiler can implement it
simply by filling in any missing arguments to the call at the call site,
using the defaults it has been given interpreted in the calling context.
It is just a convenient shorthand, equivalent to manually filling in the
missing arguments lexically.  It only works if the compiler is guaranteed
to have seen a prototype for the function with the default argument values.

This is an invalid model to use for SystemVerilog, since the compiler is
NOT guaranteed to have seen a prototype or any other declaration for the
function or task when compiling a call to it.  In the general case, there
is no way to fill in the defaults during separate compilation of the call.
The only compilation that is guaranteed to have seen the defaults is the
compilation of the task or function.  If we want to have defaults that are
interpreted in the context of the caller, then we should apply defaults
only when the compiler has seen a prototype or declaration containing the
defaults.

Steven Sharp
sharp@cadence.com
Received on Fri Mar 4 16:13:29 2005

This archive was generated by hypermail 2.1.8 : Fri Mar 04 2005 - 16:13:38 PST