Re: [Vala] Structure initialisation syntax
- From: "Sam Liddicott" <sam liddicott com>
- To: vala-list gnome org
- Subject: Re: [Vala] Structure initialisation syntax
- Date: Thu, 28 Apr 2011 10:32:58 +0100
On 27/04/11 11:30, David Given wrote:
Fabian Deutsch wrote:
[...]
Copy-n-pasting another way from the the tutorial to initialize a struct
type:
Color c3 = Color() {
red = 0.5,
green = 0.5,
blue = 1.0
};
This is really creating a temporary and then initialising c3 via
assignment, which isn't quite what I was looking for. If you look at the
generated code and compare the above with:
Color c3 = { 0.5, 0.5, 1.0 };
...you can see that the code generated by this syntax avoids the extra
copy. It seems surprising to me that the Type() { initialiser } syntax
supports designated initialisers while the Type t = { initialiser }
syntax doesn't.
File a bug report.
Sam
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]