On Wed, 2009-09-16 at 15:46 -0400, Michael B. Trausch wrote:
> On Wed, 2009-09-16 at 15:41 -0400, Michael B. Trausch wrote:
> > Did the meaning of [SimpleType] change somewhere?  I thought it meant
> > "pass by value". 
> 
> And pardon me, I'm not thinking very clearly.  That sounds wrong.
> 
> My thought was that a SimpleType could be allocated statically, and
> passing it would do something like (in C, continuing the example from
> earlier in the thread):
> 
> ip_address_t foo;
> memset(&foo, 0, sizeof(ip_address_t));
> 
> I can see writing things like this being frowned upon, but my thought
> was that a SimpleType was just that.  It seems instead that all
> allocations are supposed to come from the heap via (one way or another)
> malloc/free?  Or am I still misunderstanding something?

Vala structs are always stack/inline-allocated, it doesn't matter
whether they are annotated with [SimpleType] or not. The only meaning of
[SimpleType] is that values of these structs are passed by value in
method calls. Normal structs are passed by reference.

Jürg

_______________________________________________
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to