background preloader

C

Facebook Twitter

D

Interpreter. How to Pick a Language. How do you pick a programming language, to learn or to use for a project? This article probably overlaps a lot with what others have already said on this topic . But I try to add a categorization of programming languages that reflects the way they are discussed on blogs and discussion sites. I think these categories are often implicit in discussions on the programming sub-reddit, Hacker News, or Lambda the Ultimate, but never made explicit for the benefit of younger developers. Each section describes languages in a category, how they are similar, and what distinguishes them from each other, along with a little history.

Each section ends with reasons for choosing a language from that category (or not), and criteria for choosing between languages in the category. Let me know if these categories make sense to you, or what you think a better categorization might be. 1. C appears often on lists of languages every programmer should know. A common answer to the question “When should I use C?” The WebKit Open Source Project. CMPH - C Minimal Perfect Hashing Library.

Evil c. This is a collection of strange C (and some Java) constructs. It's probably best not to use them, but you should know why they work. The cast-to-bool operator Node *left, *right; int childCount() { return !! Left + !! Right; } Logical XOR A variation on the above. Int xor(int a, int b) { return ! The "goes toward" operator void doStuff(int count) { while(count --> 0) fleh(); } Useless but pretty definitions of BOOLs #define TRUE '/'/'/' #define FALSE '-'-'-' Two (2) readers wrote in to comment that the above is unsafe due to operator precedence. Yes. That is true. If you are doing arithmetic with the above, please seek help. Optimization, the Microsoft way This was found in the 2004 leaked Windows sources __inline BOOL SearchOneDirectory( IN LPSTR Directory, IN LPSTR FileToFind, IN LPSTR SourceFullName, IN LPSTR SourceFilePart, OUT PBOOL FoundInTree ) { // // This was way too slow.

The canonical temp-less swap a^=b^=a^=b; Duff's Device for loop unrolling Struct/class offsets Fun with comments Endian magic. FFTW Home Page.