Blog

The previous post was written in jest
Pascal Cuoq on 25 July 2012

Just a quick update to provide context for the previous post. The previous post assumes the reader is familiar with the notion of undefined behavior and how C compilers have started to justify their more aggressive optimizations along the lines of “this program has always been undefined”. Long ago, a...

Read More

On the redundancy of C99's restrict
Pascal Cuoq on 25 July 2012

The restrict keyword in C99 C99 introduced a restrict keyword. The intention is to let the programmer specify the absence of alias between some inputs of a function ey is writing. Consider the function: int f1(int * restrict p int * restrict q) { *p = 1; *q = 2;...

Read More

Results are in
Pascal Cuoq on 24 July 2012

A contest and a self-pitying lament John Regehr was organizing a craziest undefined behavior contest and the results are in. I had an entry in the contest but I did not win. My entry apparently was too obviously dangerous. As John puts it “I would have expected a modern C...

Read More

Code smells smell
Pascal Cuoq on 17 July 2012

This blog post is on the subject of “code smells” and what is wrong with them. I initially wanted to go with the title “Code smells are crap”. That made it clearer that the title was grammatically a sentence, with “code smells” a nominal group followed by a verb. But...

Read More

Undefined behavior is a harsh mistress
Pascal Cuoq on 28 June 2012

Mark Shroyer has discovered an interesting consequence of undefined behavior in the compiled version of a C program: a variable behaves as both true and false as a result of being uninitialized. The post is great and could not come at a better time. I needed for the talk I...

Read More