[sv-bc] RE: [sv-ec] overloading an assignment operator

From: Subhamoy Pal <spal_at_.....>
Date: Thu Apr 12 2007 - 10:33:47 PDT
Hi Steven,

 

SV LRM 8.16 has these lines.

================

Overloading the assignment operator also serves to overload implicit
assignments or casting. Here these are

using the same functions as the unary +.

bind = function float fcopyi(int); // cast int to float

bind = function float fcopyr(real); // cast real to float

bind = function float fcopyr(shortreal); // cast shortreal to float

 

So it means LRM gives provision for overloading assignment.

 

Thank,

Subhamoy

 

-----Original Message-----
From: Steven Sharp [mailto:sharp@cadence.com] 
Sent: Thursday, April 12, 2007 10:55 PM
To: sv-ec@eda-stds.org; sv-bc@eda-stds.org; Subhamoy Pal
Subject: Re: [sv-ec] overloading an assignment operator

 

The LRM lists the operators that can be overloaded, and it does not

include assignment.  There is other text that indicates that this

was not an oversight.  The LRM only allows overloading of operators

when applied to data types that would otherwise be illegal for them.

Assignment is legal for all data types.  The LRM also explicitly talks

about arithmetic operators, which does not include assignment.  So it

seems quite clear that an assignment operator cannot be overloaded.

 

Steven Sharp

sharp@cadence.com

 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Apr 12 10:34:07 2007

This archive was generated by hypermail 2.1.8 : Thu Apr 12 2007 - 10:34:27 PDT