Re: [sv-ec] streaming operator and const members of class

From: Daniel Mlynek <danielm@aldec.com.pl>
Date: Tue Mar 01 2011 - 23:09:49 PST

On the other hand user want just to put stream into class as single
atomic operation. He may do not care about const at this time
If it will be block then he will have no possibility of using streaming
with classes which has const.
That is imho too restrictive.

DANiel

On 3/1/2011 7:41 PM, Steven Sharp wrote:
> It is an assignment to a const, so I would expect an error.
>
> ------------------------------------------------------------------------
> *From:* owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] *On
> Behalf Of *Daniel Mlynek
> *Sent:* Tuesday, March 01, 2011 9:50 AM
> *To:* sv-ec@eda.org
> *Subject:* [sv-ec] streaming operator and const members of class
>
> LRM does not say explicitly how should tool behave if there is a
> streaming operator used to unpack stream into a class which has
> const fields.
> Const field cannot be changed - so in such situation tool should
> trigger an error?
> On the other hand this kind of operation is not typical assignment
> to const which is not allowed.
>
> Any opinions - how should below code behave
>
> CODE:
>
> class A;
> const byte a=1;
> const byte b;
> byte c;
> function new;
> b=2;
> endfunction
> endclass
>
> module top;
> A a=new;
> initial begin
> {>>{a}} = 24'h020304;
> end
> endmodule
>
> DANiel
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>,
> 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 Tue Mar 1 23:09:41 2011

This archive was generated by hypermail 2.1.8 : Tue Mar 01 2011 - 23:09:53 PST