This post originated from an RSS feed registered with .NET Buzz
by Eric Gunnerson.
Original Post: Macros
Feed Title: Eric Gunnerson's C# Compendium
Feed URL: /msdnerror.htm?aspxerrorpath=/ericgu/Rss.aspx
Feed Description: Eric comments on C#, programming and dotnet in general, and the aerodynamic characteristics of the red-nosed flying squirrel of the Lesser Antilles
In the C# design, there are a number of cases where we decided on more limited functonality than C++ for the sake of simplicity. One of those decisions was the decision to not support macros.
I know that I've run across a few cases where macros would have been really convenient...
But...
I spent about 4 hours last Friday fighting with some code as part of a restructuring I'm doing, and a lot of that time was spent dealing with the fact that somebody defined CoCreateInstance to point to a private wrapper on the function. Part of the time was spent finding that out, and the other part in restructuring include files so that my code could build without that support.
There's a considerable benefit in looking at code and knowing that is means what it says, without any renaming going on under the covers.
Incidentally, there's also a benefit in compilation model, in that compiling without a preprocessor is simpler and faster.