Re: [Vala] inline C



On Sat, 2008-12-13 at 17:46 +0000, Karl Lattimer wrote:
On Sat, 2008-12-13 at 23:44 +0600, Ildar Mulyukov wrote:
    Hi,

Take a look:
    int main (void) {
            int Cvariable;   
            __asm__ ("movl Cvariable, %eax"); // Cvariable  
contents > eax
            __asm__ ("movl $Cvariable, %ebx"); // ebx ---> Cvariable
    }

These are Assembler inline instructions, which you can use in C.

What do you think about having C inline in Vala? This looks quite  
natural for Vala. Especially while Vala is quite unperfect (having 304  
open bugs). This could ease implementing workarounds ;)

+1 it would be nicer for certain things to just use C rather than having
to write vapi e.g. the uuid.vapi I had to write for wizbit, meant more
code than just using C...

There would have to be some sanity wrapping though to make sure that the
C stuff would work properly with the vala stuff... 


You can currently get the same effect by using extern keyword for c
functions in an included c file (you can pass a .c file to valac for
this purpose) 

The disadvantage to inlining is it destroys the platform independence -
IE you would not be able to create a gcc front end for vala nor would
you be able to have vala->c++ or vala->jvm/clr. 

jamie







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