Section 2.7

LRM-169

Change (changes in red and blue):

The nesting of braces must follow the number of dimensions, unlike in C. However, replicate operators can be nested. The inner pair of braces in a replication is removed. A replication expression only operates within one dimension.

 

int n[1:2][1:3] = {2{{3{4, 5}}}}; // {{4,5,4,5,4,5},{4,5,4,5,4,5}}

 

If the type is not given by the context, it must be specified with a cast.

 

typedef int [1:3] triple [1:3]; // Array of 3 integers packed together

b = triple’{0,1,2};

$mydisplay(triple’{0,1,2});

 

Array literals can also use their index or type as a key, and a default key value (See Section 7.13);

 

b = {1:1, default:0};      // indexes 2 and 3 assigned 0.

Section 2.8

LRM-169

Change (changes in red and blue):

When an array of structures is initialized, the nested braces should reflect the array and the structure. For example:

 

ab abarr[1:0] = {{1, 1.0}, {2, 2.0}};

 

Replicate operators can be used to set the values for the exact number of members. The inner pair of braces in a replication is removed.

 

struct {int X,Y,Z;} XYZ = {3{1}};

typedef struct {int a,b[4];} ab_t;

int a,b,c;

ab_t v1[1:0] [2:0];

v1 = {2{{3{a,{2{b,c}}}}}};