Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Can you write one file of C code and compile it easily for multiple platforms or is there a lot of caveats?

Target POSIX, and there's very few caveats. You're looking at portability as "how many processors can this run on". Think of it more as "how many places can use my library if I wrote it in C".

You're missing the major upside of writing in C: if you write your library in C, it is callable (with no changes) from Python, Ruby, Java, C++, C#, Lisp ... just about any language, really.

The language is so simple that an automated tool can be used to automatically generate bindings from your language of choice to C. I use Swig. Look into Swig.

You see C as an ancient dinosaur with no use, the reality is that it is usually the only real way to write reusable software[1].

[1] Sure, you can write in C++, but you'd still have to wrap it in C.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: