s1s0 / toped

Cross platform, open source IC layout editor
http://www.toped.org.uk/
GNU General Public License v2.0
15 stars 8 forks source link

pre-initialization of list in struct not allowed #151

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
please refer to attached example

would be nice if initialization of lists, introduced several revisions ago, 
would also work in structures.

g
armin

Original issue reported on code.google.com by analogc...@gmx.net on 6 Oct 2012 at 1:59

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by krustev....@gmail.com on 11 Oct 2012 at 12:12

GoogleCodeExporter commented 9 years ago
Fixed in r2278.

(just for the record)
This case is semantically quite different from the list initialization. The 
point is that the structure is a definition of a new TYPE, so the list size in 
this case is related to the TYPE, not to a variable as it was before.
As a consequence - unlike for the variables - here a constant value is 
required. Here is an example:

int a = 2;
int b = 3;
int list vari[a+b]; //OK, declaration and initialisation
struct S {
   real list tt;// OK
   real list t[11]; // OK now
// real list error[a+b] // will fail
};
S s;// OK, declaration and initialisation

I guess - this is not a surprise though.

Original comment by krustev....@gmail.com on 11 Oct 2012 at 11:18

GoogleCodeExporter commented 9 years ago

Original comment by analogc...@gmx.net on 12 Oct 2012 at 11:57