Arturo,
I don't understand all of this, but I still have a few comments.
- The term "string" when used as a noun and not as an adjective is not
always clear. The usage appears to be inconsistent.
For example, in the sentences,
"Reading an element of a string yields a byte. A string shall not contain the special character \0 ."
What types of strings are meant here?
Or afterward,
"A string or a string literal can be assigned directly to a string variable."
What is the difference between a string and a string literal?
("can" should probably be "may".)
Note especially that for better or for worse, in 1364, the term "string" is defined as
"A string is a sequence of characters enclosed by double quotes ("") and contained on a single line."
I think the current usage of string as a noun without any adjective is confusing and inconsistent.
- You have
bit [11:0] b = 12'ha41;
string s2 = string'(b); // sets s2 to 'h0a41
'h0a41 is an unsized constant and thus at least 32 bits.
You probably mean 16'h0a41.
- "b = string'(r) ; // OK (implicit cast, implementations can issue a warning)"
"can" should probably be "may".
-
r = {"H",""}; // yields "H\0" "" is converted to 8'b0
b = {"H",""}; // yields "H" as "" is the empty string
The comments are gramatically incorrect.
In the first, there probably should be a period between "H\0" and "".
I don't know about the second.
- Question:
In:
a[0] = "h"; // OK. same as a[0] = "hi")
you deleted the second part of the comment (and forgot the closing parens).
The following statements still exists:
str.putc(i, s) replaces the ith character in str with the first character in s.
s can be any expression that can be assigned to a string.
Note: str.putc(j, x) is semantically equivalent to str[j] = x
Now I'm confused again.
What is the result of a[0] = "hi", where a is of type string?
Thanks,
Shalom
On Mon, 6 Dec 2004, Arturo Salz wrote:
> Plase find an attached proposal that specifies the interaction between string and zero characters.
>
> The proposal essentially disallows "\0" characters from being embedded in a string, and defines
> the rules for converting string literals to strings or casting integral values to a string.
>
> My apologies for the late notice.
>
> Arturo
>
>
>
-- Shalom Bresticker Shalom.Bresticker @freescale.com Design & Verification Methodology Tel: +972 9 9522268 Freescale Semiconductor Israel, Ltd. Fax: +972 9 9522890 POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 5441478 [ ]Freescale Internal Use Only [ ]Freescale Confidential ProprietaryReceived on Mon Dec 6 22:39:47 2004
This archive was generated by hypermail 2.1.8 : Mon Dec 06 2004 - 22:39:51 PST