On C++

Tuesday, May 31, 2005

There has been some discussion lately about the rise of C++ to first class citizen status in .NET country. Unfortunately, C++ still has one major flaw: the preprocessor.

The criminally insane have used the C++ preprocessor over the years to pervert, subvert, and convert otherwise good source code into an atrocious collection of tokens and symbols. I was witness to one of these atrocities in graduate school. One semester I came across a professor who was a Pascal zealot and book author. Although C++ was the official language of the curriculum, Dr. Pascal used the magic of the preprocessor to make everything look Pascal-ish. The code resembled the following sample from The Daily WTF:

procedure SelectFontIntoDC(Integer a) begin

  declare fonthandle fh;

  if (gRedraw is not false) then begin

    fh = CreateFontIndirect(gDC);

    SelectObject(gDC, fh);

    DeleteObject(fh);

  end;

end;

It is this sort of leftist brainwashing that keeps conservative parents awake at night after they drop little Johnny off in front of the freshman dorm. Pascal is Pascal, and C++ is C++ - let’s not pretend otherwise with subversive preprocessor definitions.

Sure, C++ is feature rich, but it also carries more baggage than a Four Seasons hotel porter. Jump on the C# fashion wagon – there is still room in the hold to pick up more luggage.


Comments
Andy Tuesday, May 31, 2005
Meh. So far I still don't prefer C# over C let alone C++. My quicky language if I don't need the control that C and C++ give me is still Java. But then again I'm not doing a whole lot on Windows systems. I still play around with C# once in a while for fun but in a work or contract environment I don't care for C# much.
Comments are now closed.
by K. Scott Allen K.Scott Allen
My Pluralsight Courses
The Podcast!