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.

356. _[ᶫᵒᵛᵉ]ℓข¢γ∱ะµะЯŋ¡ƈΣ -- 2018-01-19 22:35

now's a good time to fuck roslyn/coreclr/corefx/standard for removal of com if you want to preserve history.

357. _[ᶫᵒᵛᵉ]ℓข¢γ∱ะµะЯŋ¡ƈΣ -- 2018-01-19 22:36

I guess the difference is it is less corporal and with the previously mentioned projects it is easy to communicate with the developers.

358. Cranberries -- 2018-07-04 10:46

I am looking for and I love to post a comment that "The content of your post is awesome" Great work! Cranberries

359. Blueberries -- 2018-07-04 12:18

Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Blueberries

360. Raspberries -- 2018-07-04 12:48

Mmm.. good to be here in your article or post, whatever, I think I should also work hard for my own website like I see some good and updated working in your site. Raspberries

361. Elderberries -- 2018-07-04 13:10

I feel a lot more people need to read this, very good info! . [https://www.naturalfoodseries.com/11-benefits-elderberries/ Elderberries

362. Elderberries -- 2018-07-04 13:10

I feel a lot more people need to read this, very good info! . Elderberries

363. Crowberries -- 2018-07-04 19:59

It was a very good post indeed. I thoroughly enjoyed reading it in my lunch time. Will surely come and visit this blog more often. Thanks for sharing. Crowberries

364. Grapes -- 2018-07-05 16:10

A great website with interesting and unique material what else would you need. Grapes

365. Gooseberry -- 2018-07-05 16:53

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information... Gooseberry

366. David Bennett -- 2018-07-07 07:19

PS3 Emulator Android version, unlock the doors of incredible gaming fun accessing through the multifarious PS3 Games.

https://aroundandroid.com/ps3-emulator-for-android/

367. anonymous -- 2018-07-14 07:09

Hi, this is great job for macros <a href="https://www.creditcardvalid.com/fake-credit-card-numbers-work/">Fake Credit Card Numbers</a>

Add New Comment