Selecting a Programming Environment
williamaadams.wordpress.com
williamaadams.wordpress.com
A similar approach applies to the standard library. Write to the language standard, and you are good to go everywhere.
Though, I'm also dubious about using C90 for multi-threaded stuff given that there is no concept of threads in the language until C2011.
You can use a macro to swap between varargs/stdarg.h if you want to be able to use the LLVM toolchain in addition to gcc.
MSVC++ can go suck fruit wax.
Than you program some more and, if you're smart, you realize there's Common Lisp.
Modern Lisps — of which Clojure is currently the leader of the pack — would be a far better choice today.
It's not like we have a lack of those, either - Racket's my personal favorite; aside from the robust standard library, the scoped languages give me hope that the 'Lisp curse' has finally been reversed.
Sure it's not perfect, but I posit that it's a local maximum for most tasks.
And then you realize, oh, it was just "premature realisation", actually Common Lisp is not the one "to rule them all" after all.
E.g it's useless for most embedded work, a non started on the web client side, you cannot find many programmers to hire for your project, a lot of self proclaimed Lisp programmers are just dabblers, there are not enough available libs for lots of fields (, scientific computing, GUI, multimedia etc), and a thousand other reasons.
Oh, and no killer app was been made in Common Lisp, or any Lisp for that matter, with the exception of Emacs (but that one is targeted to developers anyway). In fact, the most famous example of Lisp "success" is a mid-nineties startup that was sold to Yahoo.
The language was introduced in AutoCAD Version 2.18 in January 1986, and continued to be enhanced in successive releases up to Release 13 in February 1995.
_After that, its development was neglected by Autodesk in favor of more fashionable development environments like VBA, .NET and ObjectARX. However, it has remained AutoCAD's primary user customization language._
So it looks like it has been dead for 17 years.
http://github.com/dmw/caffeine http://software.schmorp.de/pkg/libev.html
Can someone shed some light on this? The trade-off may well be worth it, but I'm only aware of the negative trade-off, not the positive.
I saw some examples in the klib code where macros are used to generate boilerplate code, generating functions.
If you take a look at the source of klist.h, the preprocessor stuff is a bit hairy, but it basically leaves you with a "compile time function", KLIST_INIT, that takes a datatype and generates, via simple textual substitution, an implementation of a linked list where each node of the list carries a payload of that datatype. klib_test.c includes a simple usage case.
Just to be clear, the preprocessor is generating real functions (inline ones, but functions nonetheless), not simply textually inserting the appropriate list code every time you use one of the macros like kl_next(iter) defined at the end of klist.h.
Check out the GCC docs on macros (and particularly, the section on concatenation) to get a better understanding of how klib implements this. http://gcc.gnu.org/onlinedocs/cpp/Macros.html
As for how "crazy" it is to do this with the preprocessor, it's just the most convenient alternative in C to manually copying and pasting a generic list implementation yourself and editing in the correct type information, so it's a fairly common practice. You'll know code that really abuses the preprocessor when you see it -- I would advise then to run.
I have my own comfort zone (Clojure, JRuby, and Java with IntelliJ and RubyMine) and I am glad William has his.
Go is my current first-choice language if I have the choice. Of course, in today's very segmented platform (web, desktop Windows, desktop Mac, desktop Linux, Android, iOS, WinPhone, et al) era, there's really no one language for everything. Even C falls down in some areas.