RE: [sv-ec] Out-of-block declarations and constraints

From: Arturo Salz <Arturo.Salz_at_.....>
Date: Wed Oct 25 2006 - 00:26:07 PDT
Dave,

 

The C++ feature to which you are alluding is not actually a language
feature. It is an artifact of C++'s separate compilation scheme in which
the job of checking whether a method is implemented or not is relegated
to the linker. I wouldn't consider this a feature, but a weakness in the
language. It is unfortunate to discover so late in the process that
someone forgot to implement a method. This is particularly painful when
the end-user of a library discovers that the library is incomplete.

 

C++ aside, the intent of section 7.22 was that the external method or
constraint *must* be defined in the scope. For a constraint, however, it
is perfectly valid to have an empty constraint block. An empty
constraint block declares the constraint name that can be overridden by
a derived class, but provides no constraints itself. A missing method
has no such semantics and must be considered an error.

 

            Arturo

 

________________________________

From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Rich, Dave
Sent: Tuesday, October 24, 2006 11:07 PM
To: sv-ec@eda-stds.org
Subject: [sv-ec] Out-of-block declarations and constraints

 

Section 7.22 and 13.4.1 describe out-of-block definitions for methods
and constraints. It is clear that the external definition must be in the
same local scope as the class definition, but is there a requirement
that there *must* be an external definition? The LRM for forward
typedefs have the requirement that they are to be resolved within the
local scope; however, the same wording is not used for external blocks.

 

The reason I ask is that C++ does not require a definition as long as no
one actually references the block. Could we allow this in SV? If we were
to apply the same rules for constraints, would a call to randomize()
count as a reference to all declared constraints?

 

Is this C++ feature unintentional, or is there a reasonable use model
for allowing this?

 

Dave

 

 

David Rich
Verification Technologist
Design Verification & Test Division
Mentor Graphics Corporation
dave_rich@mentor.com
Office:   408 487-7206
Cell:     510 589-2625

 
Received on Wed Oct 25 00:26:15 2006

This archive was generated by hypermail 2.1.8 : Wed Oct 25 2006 - 00:28:13 PDT