Subject: Re: [sv-bc] replication in array literal
From: Paul Graham (pgraham@cadence.com)
Date: Tue Jan 06 2004 - 15:04:36 PST
Let's try this:
> parameter p = 1, q = 2;
>
> struct {
> int p, q;
> } x[1:2] = { p:1, q:2 };
This fixes the out-of-bounds problem. Although section 7.13 doesn't mention
it, I was assuming that this case would call for a recursive traversal into
the type hierarchy and would find the matching p and q struct elements.
The recursive traversal rule allows you to omit braces which are otherwise
required:
int [3][3][3] x = {int:1};
I find this an unusual rule, given that SV is more strict than C about
having the braces reflect the corresponding type hierarchy.
Paul
This archive was generated by hypermail 2b28 : Tue Jan 06 2004 - 15:05:36 PST