RE: [sv-ec] copy constructor on handle pointing null

From: Daniel Mlynek <daniel.mlynek_at_.....>
Date: Wed Aug 27 2008 - 02:27:56 PDT
Te other problem is what should happen if we have:
child_hnd = new base_hnd;
 
Assigning child handle with base handle is clearly forbidden - but as per
LRM description copy constructor resolves type to be copied on runtime so in
fact "new base_hnd" can return both child class handle and base class handle
depending on type of object pointed by base_hnd.
Type of this object is known on runtime  so error should be triggered on
runtime if base_hnd points on base object and there should be no error when
base_hnd points on child object.
 
Behaviour in this case in not explicitly described in LRM so I figure out
above as the most liberal solution.
But imho such codes are very unclear and may lead to late error detection +
there is no sense in writing such code - because of that IMHO LRM should
explicitly forbids above to make it clear. What are yours opinions.
 
DANiel

  _____  

From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On
Behalf Of Daniel Mlynek
Sent: 27 sierpnia 2008 09:48
To: 'SV-EC'
Subject: [sv-ec] copy constructor on handle pointing null


LRM doesn't describe what should happend if handle which we are trying to
copy is equal null like in sample below. Should it trigger runtime error
that this is illegall null refrence, or should it silently assign
destination hadle with null ( performing no allocation)?
 
module top; 
 class C;
  int a;
 endclass 
 C c1,c2 ;
 initial begin
     c1 = new c2;    
 end
endmodule
 
 
 

-- 
This message has been scanned for viruses and 
dangerous content by  <http://www.mailscanner.info/> 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 Aug 27 02:28:49 2008

This archive was generated by hypermail 2.1.8 : Wed Aug 27 2008 - 02:29:29 PDT