Re: [sv-bc] Can aggregation be used in a dynamic array "new" initializer?

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Tue Apr 15 2008 - 07:11:34 PDT
Bresticker, Shalom wrote:
> A justification for legality is that assignment-like contexts include
> "The passing of a value to a subroutine input, output, or inout port",
> and new() is a method, which is a subroutine.

I thought of that too but the types of such implicit constructors
is not given anywhere and "new" for a dynamic array is not really
a method.  In addition, there are very special rules for how
to deal with the size of the actual array versus other contexts.

Gord.


> 
> Shalom 
> 
> 
>> Should the following be legal?
>>
>>     int a[];
>>     initial
>>        a = new[2]('{5,7});
>>
>> The aggregate is not really in an assignment like context and 
>> the type of the target is (at best) indirect.  If this should 
>> be legal, is it equivalent to:
>>
>>     typedef int T[];
>>     int a[];
>>     initial
>>        a = new[2](T'{5,7});
>>
>> or
>>
>>     typedef int T[2];
>>     int a[];
>>     initial
>>        a = new[2](T'{5,7});
>>
>> It would make a difference if the aggregate in this case was, 
>> for example, '{5,6,7} instead of '{5,7} since the type "int 
>> T[2]" would cause an error.
>>
>> I think that users would likely expect this to be legal and, 
>> given that, I think the implied type should be the dynamic 
>> array type.  However, it is not clear to me that the LRM allows this.
>>
>> So, is there consensus that this should be legal?  If so, 
>> does anyone have any opinion about what to appeal to in the 
>> LRM to claim legality (or not)?
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
> 
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> 

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Apr 15 07:12:16 2008

This archive was generated by hypermail 2.1.8 : Tue Apr 15 2008 - 07:12:26 PDT