Re: [Vala] embedding c code snippet in vala source.



On Fri, 2008-08-22 at 05:24 -0400, Yu Feng wrote:
C doesn't support inline assembly code. Some C compilers support inline
assembly but that's a compiler-specific extension to the C language.
My idea came from some experience with open watcom's asm embedding. They
encouraged people to embed asm as a whole function. While on the other
hand when I learned about gcc's asm embedding, it was really a mess that
c code is mixed with asm instructions, like GOB? Does gcc support
embedding ams as a whole function yet? 

are you talking about 'naked' functions?

They are not supported and it has been discussed to not implement them,
because like inlining asm, it is a bad design language. and implementing
asm as a whole function is the same than writing a .S file. which is
obviously not a .C :)

I found nice to embed other langs for hacking or fun, but it is a bad
design rule. breaks portability and makes the code uglier.

So C is not portable, and Vala plans to be, because it's based on GLIB
and other portable C libraries. If you embed C in your program is
probably because you need to do something specific for your system or
sthg not yet vapied.

--pancake



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