Re: [Vala] difference between using IntegerType and inheriting
Silly question: why do you want to be an integer? Most atom types are not really integers at all. I mean, given Atom a and Atom b, what does a+1 mean? a+b? max(a, b)? a * b? Usually, those answers are non-sense. Most of the methods you would inherit from the base numeric type are not helpful. You may just want: [SimpleType] [CCode (cname = "c_name", has_type_id = false)] public struct StructName { public string to_string () { return ((uint32)this).to_string (); } } On 6 January 2014 03:00, rastersoft wrote: > My question, really, is which one is the best to define in a VAPI file a > typedef. This is: if I have in C > > #typedef uint32_t xcb_atom_t; > > > is better to define it as: > > [SimpleType] > [IntegerType (rank = 9)] > [CCode (cname = "xcb_atom_t", has_type_id = false)] > public struct Atom { > } > > or as: > > [SimpleType] > [CCode (cname = "xcb_atom_t", has_type_id = false)] > public struct Atom : uint32 { > } > > > ? > > Thanks. > > El 05/01/14 22:39, Luca Bruno escribió: > >> You inherit all the methods from uint32? ;) >> >> >> On Sun, Jan 5, 2014 at 9:51 PM, rastersoft wrote: >> >> Hi again: >>> >>> Another doubt I have is: what is the difference between doing: >>> >>> [SimpleType] >>> [IntegerType (rank = 9)] >>> [CCode (cname = "c_name", has_type_id = false)] >>> public struct StructName { >>> } >>> >>> and >>> >>> [SimpleType] >>> [CCode (cname = "c_name", has_type_id = false)] >>> public struct StructName : uint32 { >>> } >>> >>> Thanks >>> >>> -- >>> Nos leemos >>> RASTER(Linux user #228804) >>> ras...@rastersoft.com http://www.rastersoft.com >>> >>> ___ >>> vala-list mailing list >>> vala-list@gnome.org >>> https://mail.gnome.org/mailman/listinfo/vala-list >>> >>> >> >> > -- > Nos leemos > RASTER(Linux user #228804) > ras...@rastersoft.com http://www.rastersoft.com > > ___ > vala-list mailing list > vala-list@gnome.org > https://mail.gnome.org/mailman/listinfo/vala-list > -- --Andre Masella http://www.masella.name/ ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] difference between using IntegerType and inheriting
Guess the second. On Mon, Jan 6, 2014 at 12:00 PM, rastersoft wrote: > My question, really, is which one is the best to define in a VAPI file a > typedef. This is: if I have in C > > #typedef uint32_t xcb_atom_t; > > > is better to define it as: > > [SimpleType] > [IntegerType (rank = 9)] > [CCode (cname = "xcb_atom_t", has_type_id = false)] > public struct Atom { > } > > or as: > > [SimpleType] > [CCode (cname = "xcb_atom_t", has_type_id = false)] > public struct Atom : uint32 { > } > > > ? > > Thanks. > > El 05/01/14 22:39, Luca Bruno escribió: > >> You inherit all the methods from uint32? ;) >> >> >> On Sun, Jan 5, 2014 at 9:51 PM, rastersoft wrote: >> >> Hi again: >>> >>> Another doubt I have is: what is the difference between doing: >>> >>> [SimpleType] >>> [IntegerType (rank = 9)] >>> [CCode (cname = "c_name", has_type_id = false)] >>> public struct StructName { >>> } >>> >>> and >>> >>> [SimpleType] >>> [CCode (cname = "c_name", has_type_id = false)] >>> public struct StructName : uint32 { >>> } >>> >>> Thanks >>> >>> -- >>> Nos leemos >>> RASTER(Linux user #228804) >>> ras...@rastersoft.com http://www.rastersoft.com >>> >>> ___ >>> vala-list mailing list >>> vala-list@gnome.org >>> https://mail.gnome.org/mailman/listinfo/vala-list >>> >>> >> >> > -- > Nos leemos > RASTER(Linux user #228804) > ras...@rastersoft.com http://www.rastersoft.com > > -- www.debian.org - The Universal Operating System ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] difference between using IntegerType and inheriting
My question, really, is which one is the best to define in a VAPI file a typedef. This is: if I have in C #typedef uint32_t xcb_atom_t; is better to define it as: [SimpleType] [IntegerType (rank = 9)] [CCode (cname = "xcb_atom_t", has_type_id = false)] public struct Atom { } or as: [SimpleType] [CCode (cname = "xcb_atom_t", has_type_id = false)] public struct Atom : uint32 { } ? Thanks. El 05/01/14 22:39, Luca Bruno escribió: You inherit all the methods from uint32? ;) On Sun, Jan 5, 2014 at 9:51 PM, rastersoft wrote: Hi again: Another doubt I have is: what is the difference between doing: [SimpleType] [IntegerType (rank = 9)] [CCode (cname = "c_name", has_type_id = false)] public struct StructName { } and [SimpleType] [CCode (cname = "c_name", has_type_id = false)] public struct StructName : uint32 { } Thanks -- Nos leemos RASTER(Linux user #228804) ras...@rastersoft.com http://www.rastersoft.com ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list -- Nos leemos RASTER(Linux user #228804) ras...@rastersoft.com http://www.rastersoft.com ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] difference between using IntegerType and inheriting
You inherit all the methods from uint32? ;) On Sun, Jan 5, 2014 at 9:51 PM, rastersoft wrote: > Hi again: > > Another doubt I have is: what is the difference between doing: > > [SimpleType] > [IntegerType (rank = 9)] > [CCode (cname = "c_name", has_type_id = false)] > public struct StructName { > } > > and > > [SimpleType] > [CCode (cname = "c_name", has_type_id = false)] > public struct StructName : uint32 { > } > > Thanks > > -- > Nos leemos > RASTER(Linux user #228804) > ras...@rastersoft.com http://www.rastersoft.com > > ___ > vala-list mailing list > vala-list@gnome.org > https://mail.gnome.org/mailman/listinfo/vala-list > -- www.debian.org - The Universal Operating System ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
[Vala] difference between using IntegerType and inheriting
Hi again: Another doubt I have is: what is the difference between doing: [SimpleType] [IntegerType (rank = 9)] [CCode (cname = "c_name", has_type_id = false)] public struct StructName { } and [SimpleType] [CCode (cname = "c_name", has_type_id = false)] public struct StructName : uint32 { } Thanks -- Nos leemos RASTER(Linux user #228804) ras...@rastersoft.com http://www.rastersoft.com ___ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list