RE: [sv-ec] A question about copy constructors

From: William Paulsen <paulsen_at_.....>
Date: Wed Jan 17 2007 - 15:21:41 PST
Dave Rich:

Do people agree with Arturo about the type of "p1" in the example below?
(This is different from the first email comments I received.)


And can 1382 be reopened, so that the errata can be modified?  Item 1 in
the new paragraph would now be:

"1. An object of the >>> dynamic <<< class type being copied is
allocated. This allocation shall not call the object's constructor or
execute any variable declaration initialization assignments.


Thanks,
Bill


-----Original Message-----
From: Arturo Salz [mailto:Arturo.Salz@synopsys.com] 
Sent: Tuesday, January 16, 2007 8:10 PM
To: William Paulsen; Rich, Dave; sv-ec@eda-stds.org
Subject: RE: [sv-ec] A question about copy constructors

Bill,

I agree that the LRM needs to clarify this point.

The only type that I think makes sense is the dynamic type (c3 in your
example).

	Arturo

-----Original Message-----
From: William Paulsen [mailto:paulsen@cadence.com]
Sent: Tuesday, January 16, 2007 2:51 PM
To: Arturo Salz; Rich, Dave; sv-ec@eda-stds.org
Subject: RE: [sv-ec] A question about copy constructors

 
But the errata for mantis 1382 seems ambiguous.  The first sentence of
item 1 of the new paragraph says for shallow copy:

"An object of the class type being copied is allocated."


Is this the static type?   Or the dynamic type?

In my example below, the static type of p2 is "class c2", but the
dynamic type is "class c3":

     c1 p1 = new p2;  // what is the type of the object: c1, c2, or c3?


I think the errata should be explicit about the type (static or
dynamic).


Thanks,
Bill


Here's the mantis 1832 errata:

http://www.eda.org/svdb/file_download.php?file_id=1500&type=bug



-----Original Message-----
From: Arturo Salz [mailto:Arturo.Salz@synopsys.com]
Sent: Tuesday, January 16, 2007 3:38 PM
To: Rich, Dave; William Paulsen; sv-ec@eda-stds.org
Subject: RE: [sv-ec] A question about copy constructors

Oops. I take that back. I just went and re-read the proposal.

Dave is right. The constructor new p2 creates an object of type c2 and
the handle to the new object is assigned to p1.

Sorry for the confusion.

	Arturo

-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Arturo Salz
Sent: Tuesday, January 16, 2007 12:28 PM
To: Rich, Dave; William Paulsen; sv-ec@eda-stds.org
Subject: RE: [sv-ec] A question about copy constructors

That is not what mantis 1382 was about.

In the example p1 is of type c1 (the base class). I believe the question
is whether the shallow copy performs an auto-cast from p2 to p1 in this
case. I believe the answer is yes.

	Arturo

-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Rich, Dave
Sent: Tuesday, January 16, 2007 11:44 AM
To: William Paulsen; sv-ec@eda-stds.org
Subject: RE: [sv-ec] A question about copy constructors

This was mantis 0001382 which was approved in September.

p1 will be point to an object of type c2.

Dave


> -----Original Message-----
> From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org]
On
> Behalf Of William Paulsen
> Sent: Tuesday, January 16, 2007 11:31 AM
> To: sv-ec@server.eda-stds.org
> Subject: [sv-ec] A question about copy constructors
> 
> Hi,
> 
> The LRM does not seem to be clear about the last statement in the 
> example below.  Can someone clarify this?
> 
> Thanks,
> Bill Paulsen
> 
> 
> 
> module m;
>     class c1
>     endclass
> 
>     class c2 extends c1;
>     endclass
> 
>     class c3 extends c2;
>     endclass
> 
>     c3 p3 = new;
>     c2 p2 = p3;
>     c1 p1 = new p2;  // what is the type of the object: c1, c2, or c3?
> endmodule
> 
> 
> --
> This message has been scanned for viruses and dangerous content by 
> MailScanner, and is believed to be clean.
> 


--
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jan 17 15:22:06 2007

This archive was generated by hypermail 2.1.8 : Wed Jan 17 2007 - 15:22:31 PST