Re: [Vala] VAPI-Bindings to obscure c-types.



________________________________
From: Guillaume Poirier-Morency <guillaumepoiriermorency gmail com>
Sent: Monday, 5 December 2016, 17:30
Subject: Re: [Vala] VAPI-Bindings to obscure c-types.

You could also use a [FloatingType] declaration and not mess with pre-processor directives.

[FloatingType]
public struct dReal {}


Nice solution. I presume [FloatingType] allows for the struct to be initialized with a real literal, whereas 
just using [SimpleType] means it has to use the struct syntax. So

dReal x = 1.23456;

instead of 


dReal x = { 1.23456 );

 [SimpleType]
 [CCode (cname = "dReal", has_type_id = false)]
 public struct dReal : float {
 }


In terms of Vala syntax I think [FloatingType], [IntegerType] and [BooleanType] enable the use of the 
relevant Vala literal syntax when initializing the struct. I'm not so sure about the implicit casting rules 
in Vala, is the rank detail required? There is also a width detail.

In terms of the C code generated the glib-2.0.vapi also has CCode details for 'default_value' and for doubles 
'type_signature'. Not sure how relevant they are.

It would be nice to get my understanding of [FloatingType], [IntegerType] and [BooleanType] nailed and I'll 
try updating the Simple Types section of the Legacy Bindings doc.

Al


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]