Macros are evil

I’m innocently developing a device context class for my LFC framework and I want a method called SelectPen. All of a sudden I’m getting very weird linker errors about how SelectPen is not defined.

It turns out that SelectPen is a macro defined in windowsx.h as an alias for SelectObject.

#define SelectPen(hdc, hpen) ((HPEN)SelectObject((hdc), (HGDIOBJ)(HPEN)(hpen))) Very annoying.Very annoying.Very annoying.

2 thoughts on “Macros are evil

  1. Alix

    I just HAVE to know, where do you fall on the MAC – PC, OSX – XP Spectrums?

    I find the whole Macs vs PCs thing a little funny.

    “DIE MACS, DIE!!!”

    “PCs SUCK!!”

    “NO – MACS SUCK!”

    “NAH-UH!”

    “UH-HUH!”

  2. pepethecow Post author

    Most of me thinks the whole debate is a little silly. Some computers work for some people, others don’t. It’s often largely a factor of what you learned on.

    That said, Apple has declining market share and they just announced that Windows will run on Macs now. Partly, that’s a slap in the face to some of the Mac fanatics who held out as different and better than Windows.

    Now if Microsoft produces a version of Linux the circle will be complete. 🙂

Comments are closed.