Re: [Vala] Variable-length array in struct and initializing an array of such structs
- From: Al Thomas <astavale yahoo co uk>
- To: "vala-list gnome org" <vala-list gnome org>
- Subject: Re: [Vala] Variable-length array in struct and initializing an array of such structs
- Date: Thu, 23 Jul 2015 18:27:22 +0000 (UTC)
From: Steef Hegeman <steefhegeman hotmail com>
Sent: Thursday, 23 July 2015, 18:47
Subject: [Vala] Variable-length array in struct and initializing an array of such structs
If I understand correctly, arrays declared like this:
type[] an_array
are arrays with a variable length. This gets translated into C as a
pointer to a dynamically allocated array, with some extra fixed-size
variables like length and size. Is this correct?
...
Then I tried using it in the following manner:> const Test[] tests = {
{ 2.5, {1, 2, 3} },
{ 3.5, {2, 3} }> };
I don't have the definitive answer, but a quick read of your email
makes me wonder why you are using const for a dynamic array.
As I understand it const indicates the variable content
does not change at run time, i.e. it is not dynamic.
Al
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]