| Anonymous | Login | 2010-09-02 20:25 PDT |
| Main | My View | View Issues | Docs | Wiki |
| Viewing Issue Simple Details [ Jump to Notes ] [ Wiki ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||
| ID | Category | Severity | Date Submitted | Last Update | |||
| 0002692 | [SystemVerilog P1800] SV-EC | major | 2009-04-13 07:08 | 2009-07-02 15:19 | |||
| Reporter | shalom | View Status | public | ||||
| Assigned To | |||||||
| Priority | normal | Resolution | no change required | ||||
| Status | closed | Product Version | P1800-2009/D8 Ballot | ||||
| Summary | 0002692: Ballot comment #79: Default argument values in function prototype and implementation | ||||||
| Description | 13.5.3: Please make it clear whether for out-of-block functions, default argument values have to be declared in both the prototype and the implementation or just one. | ||||||
| Additional Information | |||||||
| Tags | No tags attached. | ||||||
| Type | Clarification | ||||||
| Attached Files | |||||||
|
|
|||||||
Relationships |
|||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||
Notes |
|
|
shalom (manager) 2009-04-13 07:16 |
I don't know whether this comment was intended to refer to class methods (see 0002385, 0001584, 0002451) or interface methods |
|
shalom (manager) 2009-04-19 00:56 edited on: 2009-04-27 01:27 |
13.5.3 does not talk about out-of-block function declarations. The comment uses the term "out-of-block". This term is used with respect to class methods in 8.23, so apparently that was the context of the comment. 8.23 does not discuss this point explicitly, it says, "The out-of-block method declaration shall match the prototype declaration exactly; the only syntactical difference is that the method name is preceded by the class name and the class scope resolution operator ::." 8.19, on Virtual methods, says, "when subclasses override virtual methods, they shall follow the prototype exactly by having matching return types and matching argument names, types, and directions. It is not necessary to have matching default expressions, but the presence of a default shall match." See 0002451 and the referenced discussions on the SV-EC reflector, indicating that there indeed has been confusion on this, and discussion about what the LRM *should* say. For interface methods, 25.7 says, "If a default argument value is needed in a subroutine call, it shall be specified in the prototype. If an argument has default values specified in both the prototype and the declaration, the specified values need not be the same, but the default value used shall be the one specified in the prototype." This indicates that if a default is specified in the prototype, it is not required to be specified in the implementation as well. I think this issue should move to SV-EC. |
|
mmaidment (manager) 2009-05-03 23:32 |
On April 27, 2009 the SV-BC reviewed the issue and unanimously agreed that this issue is better suited for SV-EC. |
|
Steven Sharp (developer) 2009-06-01 13:18 |
I believe that the LRM is clear. It says that the only syntactical difference for an out of block declaration is the class name ::. Since the default is part of the syntax, it cannot be different. I agree that it would be convenient to allow the default to be left off of the out of block declaration, and could support such a change. But the current LRM seems clear in not allowing this. Section 8.19 says that the virtual method overrides shall follow the prototype exactly, but continues to say in what way they must match (return types, and matching argument names, types and directions.) It explicitly says that the defaults need not match. Virtual methods are a different situation from an out of block declaration, so the rules need not match. In an out of block declaration, you are re-declaring the same subroutine. With a virtual method, you are declaring a different implementation. Though the LRM does not make this clear, I have inferred that the default is taken from the implementation actually called (i.e. the default is "virtual"). The reference in 25.7 is also not talking about an out of block declaration. It is talking about interface import task/function declarations. It does not directly conflict with the rule for out of block declarations. I think it would be better if the same rules were used for both, but the rules seem to be clear for both. So I disagree with the statement "This indicates that if a default is specified in the prototype, it is not required to be specified in the implementation as well." This is true for an interface task/function. That does not make it true for an out of block declaration. These are different constructs whose rules have been specified separately and differently. I would be fine with changing the rules for out of block declarations to match interface tasks/functions. I would be fine with changing both rules to allow leaving the default off of the implementation but not allow mismatching default values. But I think the current LRM is clear that for an out of block declaration, the default values must match the prototype. |
|
shalom (manager) 2009-06-02 05:14 |
When I wrote "This indicates that if a default is specified in the prototype, it is not required to be specified in the implementation as well," I was talking only about the meaning in 25.7. |
|
Steven Sharp (developer) 2009-06-08 12:37 |
The SV-EC believes that the LRM is already clear on this matter. In 8.23 the LRM says that the only syntactical difference for an out of block declaration is the class name :: syntax. Since the default is part of the syntax, it cannot be different. The SV-EC may consider relaxing this requirement in a future revision of the LRM. However, there is not sufficient time to work out the details of this for the current LRM. |
|
mehdi_mohtashemi (manager) 2009-06-13 18:35 |
SV-EC conference call on June 8th 2009 unanimously approved 'no change required' for mantis 2692 [ballot id #79]. |
|
Dave Rich (manager) 2009-07-01 10:41 |
The Champions have voted unanimously to approve this issue on June 29, 2009 |
|
Dave Rich (manager) 2009-07-02 15:16 |
The P1800-2009 Working Group approved the resolution of this issue as no change required. |
| Mantis 1.1.7[^] Copyright © 2000 - 2008 Mantis Group |