Re: [sv-ec] Re: [sv-bc] question on str.putc()

From: Steven Sharp <sharp@cadence.com>
Date: Sat Oct 16 2004 - 14:29:11 PDT

>> Why is this being defined inconsistently with other assignments in the
>> language?
>
>I believe that the reason for this is due to the fact that the string
>data type is based upon the C++ Standard Template Library implementation
>of its string class. In the STL implementation the leftmost character
>has index 0. This is consistent with how C-strings are used.

I have no problem with specifying that the leftmost character has index 0,
though the LRM fails to do so. Verilog allows specifying ranges in either,
direction, so the predefined range for a string can easily be specified
to have 0 for the leftmost character.

The issue is with the truncation rules when assigning to that character.
The comment in the example in 3.7 is wrong, and the note that Shalom
pointed out is wrong if x is a string wider than 1 character.

Steven Sharp
sharp@cadence.com
Received on Sat Oct 16 14:29:18 2004

This archive was generated by hypermail 2.1.8 : Sat Oct 16 2004 - 14:29:24 PDT