Blog

Option to make GCC conform to C99 re:floating-point
Pascal Cuoq on 23 January 2012

The existence of this option to make GCC conform to C99 when compiling for the x87 floating-point instruction set is informative. The commentary that comes with the patch is quite interesting, if you are into this sort of thing. If you are not that much into the minutiae of the...

Read More

A reference peeve
Pascal Cuoq on 20 January 2012

One thing has been peeving me for a while. It is small and does not impact me directly, so I didn't speak up, but perhaps I should. Many people, some of whom should know better, mention Floyd, Hoare and Dijkstra in the same sentence as modern verification condition generators (Frama-C's...

Read More

Math proofs and programming
Pascal Cuoq on 20 January 2012

Speaking of John Carmack, in his twitter feed, he notes: In hindsight it is surprising that I disliked doing math proofs in high school despite already being a programmer. It says a lot about the French education system that I started teaching myself programming at 6 and officially switched from...

Read More

Checking for overflows operation by operation
Pascal Cuoq on 20 January 2012

My colleague Bernard Botella pointed out an interesting example in an offline discussion following the last quiz. The setup Consider the snippet: int s; unsigned u1 u2; ... s = u1 - u2; The programmer's intention with the assignment is to compute in variable s of type int the mathematical...

Read More

A bit of explanation regarding the quiz in the last post
Pascal Cuoq on 20 January 2012

There are only positive constants in C, as per section 6.4.4 in the C99 standard: integer-constant: decimal-constant integer-suffixopt octal-constant integer-suffixopt hexadecimal-constant integer-suffixopt decimal-constant: nonzero-digit decimal-constant digit octal-constant: 0 octal-constant octal-digit hexadecimal-constant: hexadecimal-prefix hexadecimal-digit hexadecimal-constant hexadecimal-digit ... The minus sign is not part of the constant according to the grammar. The...

Read More