[Vala] Vala volatile (C memory model & freedom to define types)



Hello.

For some libgee work I need to have working volatile. The problem is
that this support needs a bit care (in short - it does not work on any
profile but it breaks in different places - see bug #622338 [1] for
breakage on lexer in non-dova profile and bug #648330 [2] for silently
not working in dova profile)

I guess that the problem is that from POV of vala there is no
possibility of annotating pointers. I.e. the modifications of types
applies to types only and not to pointers (for ex. const pointers are
not supported).

However the problem with most usage of volatile is that it *requires*
low-level access:

 - int volatile * specifies a pointer to volatile area (i.e. one that is
beyond control of processor). It can be specified as volatile int * as
well.
 - int * volatile specifies a pointer that is beyond control of
processor

Those are two distinct cases. Arguably the second one is more common in
mid-HL languages (the first one is need for the original use of volatile
i.e. the memory-mapped I/O).

I can produce patches for it but:

 - How should the volatile pointer be specified in syntax?
 - How should the pointer to volatile memory be specified? Is it needed
at all?
 - Do we want to keep compatibility with C bracketing?
 - What about brother of volatile (const)?

Solutions:

 - volatile brackets like in C. I.e. volatile int * is (volatile int) *
not volatile (int *)
 - volatile brackets like in C but can be only on RHS of the bracketing
int volatile * is (int volatile) * while int * volatile is (int *)
volatile
 - volatile only corresponds to memory it specifies. I.e. volatile int *
is volatile (int *). This is implemented by patches to bug 648330 [2]

Regards

[1] https://bugzilla.gnome.org/show_bug.cgi?id=622338
[2] https://bugzilla.gnome.org/show_bug.cgi?id=648330

Attachment: signature.asc
Description: This is a digitally signed message part



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