Subject: Re: [sv-bc] Question on void-returning functions
From: Dave Rich (David.Rich@synopsys.com)
Date: Thu Aug 28 2003 - 15:01:35 PDT
Hi Doug,
I believe you have found a mistake in the the BNF.
| { attribute_instance } void'(function_call)
should have been added to statement_item and function_statement_item,
instead of primary. Then it will agree with the LRM
I propose that we
A) remove from primary production in A.8.4
| void'(function_call)
B) Add to both the statement_item and function_statement_itemproductions
in A.6.4
| { attribute_instance } void'(function_call)
I just typed this up and see that Brad already filed BC-65 for this
issue. Now it has a proposal
Dave
Warmke, Doug wrote:
>Hi SV-BC,
>
>We are wondering about the LRM treatment of discarding fn results via a
>cast to void:
>
>a. "Function calls are expressions unless of type void, which are
>statments."
> LRM 10.3.1. This certainly seems reasonable.
>
>b. Then we can effectively turn a non-void fn call into a void fn call
> via casting (LRM 10.3.2):
> "...using the void data type to discard a function's return value,
> which is done by casting the function to the void type:
> void'(some_function());
>
>c. Note that the example above shows a the void cast-fn as essentially a
> stand-alone stmt, not part of an expression. This makes perfect sense,
> since we are effectively turing the fn into a void fn, which 10.3.1 says
> are statements.
>
>d. However, in the grammar, we have a void-cast-fn not as a statement,
> but as a 'primary' under A.8.4:
> primary ::= number
> | ...
> | function_call
> | void'(function_call)
> |...
>
>e. Is this just an oversight, or are we missing out on something here?
> In a syntactic sense, one would expect to see a void cast as a statement
>--
> just like the LRM example. Otherwise, as a primary, it supposedly can
>appear
> in range expressions, with binary operators, etc. (A.8.3), which makes no
> semantic sense for void.
>
>f. The reason for caring is to see if one can handle void-fn-calls
> and cast-to-void-fn-calls in as similar way as possible.
>
>Thanks and regards,
>Doug Warmke
>
>
>
>
-- -- David.Rich@Synopsys.com Technical Marketing Consultant http://www.SystemVerilog.org tele: 650-584-4026 cell: 510-589-2625
This archive was generated by hypermail 2b28 : Thu Aug 28 2003 - 15:03:25 PDT