Academic Talk on Wed 4th November 2015
Abusing the C preprocessor for good and evil
Wed 4th November 2015, 17:00 - Wed 4th November 2015, 18:00
(The talk will take place in CS0.07)
A talk by Simon Tatham, the creator of Putty amongst other things.
The C language's preprocessor stage is an unusual relic of old-fashioned
language design. It was introduced as a cheap way of doing several
different jobs, but it doesn't do any of them all that well. Modern
language designers tend to consider the C preprocessor as dangerous and
harmful, and classify all its applications into (a) things they should
replace with a proper type-safe piece of language design, and (b) things
nobody should have been doing in the first place.
They're not wrong, of course. Use of the C preprocessor can indeed be
dangerous, and it has all sorts of pitfalls. But it's all about what
direction you point it in: in this talk, I'll give some examples of how
you can use that same dangerous tool to make your C programming _safer_.
Then, just as you're thinking it might not be so bad after all, I'll
present some advanced abuses of the preprocessor which will probably
make you agree with the language designers who want to get rid of it!