Yes, the preprocessor…

The preprocessor is one of the biggest obstacles to readable C-to-Go 
translation. rsc/c2go largely ignores preprocessor directives other than 
#include—and it doesn’t include a translation of the headers at the top of 
every output file. But most C programs are a lot more dependent on the 
preprocessor than gc was. So every other C-to-Go tool I’ve seen works from 
preprocessed source. So they tend to dump a translation of most of /usr/include 
at the top of the file. (Leaven doesn’t, though, because clang optimizes most 
of that stuff back out.) And some functions are halfway to machine code by the 
time all the macros are expanded.

A good translation from C to Go needs to look as much like the original, 
un-preprocessed C source as possible. But a powerful translation tool will 
probably need to preprocess, parse, and typecheck the code, while keeping track 
of the source location that everything corresponds to—and then use that 
information to guide the translation.

Andy

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to