Article 1PYCA Representative Line: Compatibly Backward

Representative Line: Compatibly Backward

by
Remy Porter
from The Daily WTF on (#1PYCA)

I took my first official programming class circa 1997, and that year was notable, only because it was the last years that class was taught using Turbo Pascal. In future years, it was taught in C++. For the teacher, this was quite the transition. To help her make the transition, at the end of the course, she spent a few days teaching us basic C++, so she'd be more ready for the following class, and we got a little bonus education.

As far as I know, future runs of the class went just fine. I bring this up, because Frank had some co-workers who needed to make the exact same transition, from Turbo Pascal to C++. They may have done it a bit less gracefully. When reviewing some of the C++ they wrote, Frank spotted lots of code like:

if (counter > 0) then{ // do something in here}

It was the then that caught his eye. It took some hunting around, but buried deep in a header file included in every other file, everywhere, he found this:

#define then

Yes, they defined an empty, do-nothing macro just so they could still type then with their if statements.

proget-icon.png [Advertisement] Universal Package Manager - store all your Maven, NuGet, Chocolatey, npm, Bower, TFS, TeamCity, Jenkins packages in one central location. Learn more today! TheDailyWtf?d=yIl2AUoC8zAbb5ZX8tvfeo
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments