Monday, February 9, 2004

Builtins in C

Here's an interesting article on Kuro5hin: Why C Is Not My Favorite Programming Language. The article is a response to a rant from Brian Kernighan (over 20 years ago) called Why Pascal Is Not My Favorite Programming Language. It's an interesting article and makes good points about the ability to introduce buffer overflows very easily. For the most part though, the article is simply complaining about the amount of rope that C gives you to hang yourself with. Or should I say shoot yourself in the foot. One of the comments in the article was trying to make an example of the C builtins. The one I found most interesting was the branch prediction builtin __builtin_expect which lets you assist the compiler is branch prediction. Documentation for some of the other interesting builtins is here.