Re: Precompiled include files
- Posted by mattlewis (admin) Aug 13, 2013
- 1404 views
Yes, the version of the translator the defined words and the defined words will effect the resulting C code. Even if you compare the convert.c in intobj and transobj using the same interpreter/translator you will find different symbols inside the routines and different names for the routines themselves. They must be named this way to avoid conflicts among routines that have the same name.
These routines are not even necessarily functionally equivalent if I understand what Matt is saying.
At the C level, this can be true. Consider the following simple example:
-- foo.ex export procedure foo( object o ) if sequence( o ) then ? 1 elsif integer( o ) then ? 2 elsif atom( o ) then ? 3 end if end procedure foo( 1 ) foo( "bar" ) foo( 1.5 )
Try commenting out different calls of foo, and look at the translated result. The translator isn't smart enough to omit the if blocks, but you'll note that you get things like:
/** foo.ex:5 elsif integer( o ) then*/ _9 = 1; if (_9 == 0) { _9 = NOVALUE; goto L3; // [22] 33 } else{ _9 = NOVALUE; }
...and so the C compiler will be able to optimize this away.
Matt