Fuck you, Microsoft: near and far macros

If you target the Windows platform, chances are that your code will have this:

#include <windows.h>

Which in turns includes <windef.h>, which unconditionally defines the following macros:

#define far
#define near

Right. Because there’s no chance in hell that, writing 3D code for Windows, someone’s gonna name any of their variables near or far. Never happens. Never will.

Fuck you, Microsoft, for not even providing a way to disable that monstrosity with a global macro such as NOFUCKINGMACROSFROMTHEEIGHTIES but instead requiring me to #undef those macros after each inclusion of <windows.h>. And it’s not like you don’t know how to do that, because you provide NOMINMAX which deactivates your min() and max() macros in the same fucking file. Fuck you for silently breaking code that compiles cleanly on every platform, Mac OS X, Android or the Playstation.

I refuse to be swayed by your terror tactics and name my variables m_fNearPlaneClipDistance or whatever deranged mind decides is better. My near and far values are called near and far, because I love this naming scheme, and if you don’t, fuck you and your fat wife.

  • Posted: 2011-03-04 13:44 (Updated: 2011-03-04 14:54)
  • Author: sam
  • Categories: windows rant code

Comments

1. anonymous -- 2012-03-21 01:00

One day I defined a function that took parameters measured in radians called "rad1" and "rad2". Turns out that Microsoft has #defined rad1 0x0420 and rad2 0x0421. Fine, whatever, but the resulting error message doesn't give me any clue why the heck my perfectly reasonable function declaration wouldn't compile. Then later I defined a pair of variables called "large" and "small". Well, Microsoft's rpcndr.h (whatever that is) has "#define small char".

2. anonymous -- 2012-06-18 21:46

I'm totally agree with you. I had a same trouble today!

3. Pietro Gagliardi (andlabs) -- 2014-05-06 03:56

Some years late, but.

Welcome to the wonderful world of compatibility. Specifically, in the dark age of 16-bit Windows, before 3D programming was really a thing (yes I know this is inaccurate), you had these things called "near pointers" and "far pointers". Raymond Chen talks about them here: http://blogs.msdn.com/b/oldnewthing/archive/2004/11/01/250610.aspx (and a few other places).

And so to continue to support this ancient code, which they MUST support (Raymond Chen again: http://blogs.msdn.com/b/oldnewthing/archive/2004/03/01/82103.aspx), you get these macros.

It's a shame Microsoft doesn't provide an override switch like they do with min()/max(). Here's a silent #define to get (as far as I know, legitimately) angry about: #define small char From what I can tell it's a MIDL leftover in rpcndr.h.

19. Smithe841 -- 2016-12-23 21:20

Do you mind if I quote a few of your posts as long as I provide credit and sources back to your weblog? My blog is in the very same niche as yours and my users would truly benefit from a lot of the information you present here. Please let me know if this alright with you. Thank you! fgbdfadefebecefe

46. BiesCaw -- 2017-01-02 14:37

Hello, I just wanted to say hi, vast to be here, enticing comunity! In case you interested, my website: http://motiondetector.xyz

55. Joyce@tiZ -- 2017-01-16 18:29

Hi boys! I have nice videoshow for you! Join to see my perfect body!! http://goo.gl/YGwvnM I’m waiting for you!!!

58. Joyce@tiZ -- 2017-01-17 19:13

Amanda need relaXXXing Massage >> http://goo.gl/WoaOm6 <-- #like4like #vitaindiretta #tru_beauty

60. Sharon@Scaro -- 2017-01-19 08:33

Most characters will be naked and performing aggressive sexual actions, will you allow it? http://goo.gl/4uwwKV

61. LauriLok -- 2017-01-19 21:35

Fast Ties for Rough Sex >> http://goo.gl/WoaOm6 #cum #cock #cumtribute

94. Allhek -- 2017-01-24 14:04
101. Smithb938 -- 2017-01-26 00:32

You have brought up a very excellent details , regards for the post. kdecdgcdeedecgkf

103. Agata@phalk -- 2017-01-27 09:57

#Hardcore anal compilation (fast) http://goo.gl/mZ7OI7 #hunks #stream #bitch #fuck #fun #

107. Agata@phalk -- 2017-01-28 15:03

Huge natural titties blonde sheer hose screw http://goo.gl/mZ7OI7

111. Agata@phalk -- 2017-01-29 06:48

Super online sex game! http://goo.gl/mZ7OI7

114. LauriLok -- 2017-01-30 08:07

Fast Ties for Rough Sex >> http://goo.gl/mZ7OI7 #cum #cock #cumtribute

126. Visit Website -- 2017-02-01 08:02

XWCuDX You are my inspiration , I have few web logs and rarely run out from to brand.

139. Svetlana@fet -- 2017-02-06 12:37

Hi boys! I have nice videoshow for you! Join to see my perfect fitness body!! >>> http://ufgd.at.ua I’m waiting for you!!!

152. Lauri_Lok -- 2017-02-13 19:55

[b]Cam sex Find it hereb http://goo.gl/tFf5Ys

166. Smithb715 -- 2017-02-25 00:50

Today, while I was at work, my sister stole my apple ipad and tested to see if it can survive a 30 foot drop, just so she can be a youtube sensation. My apple ipad is now broken and she has 83 views. I know this is entirely off topic but I had to share it with someone! acgeebkcddacgfec

167. Linda@CON -- 2017-02-25 19:51

Free Sex Tube Videos: Hot HD Porn Movies & Mobile XXX >> http://goo.gl/oPPZp3

200. Bermakle -- 2017-03-20 11:40

Владелец http://healbio.ru/ лох.

204. XRumerTest -- 2017-03-21 04:10

Hello. And Bye.

347. XRumerTest -- 2017-04-29 00:18

Hello. And Bye.

355. XRumerTest -- 2017-05-10 09:10

Hello. And Bye.

Add New Comment