18

And where does Microsoft get away with

#define small char

You can't just add reserved words to the language and quietly include them in a platform SDK!

And more importantly how do I get rid of it!

edit : how to find what is being included where and by what in Visual Studio - Displaying the #include hierarchy for a C++ file in Visual Studio

Community
  • 1
  • 1
Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
  • @unapersson - it could come with a little note saying - this SDK will add another sdk which will break a whole bunch of your code. – Martin Beckett May 03 '11 at 18:58
  • @Martin - I'm curious about why your build is including this in the first place. – Steve Townsend May 03 '11 at 19:13
  • @Steve - so am I! I have the build set to v100 and this header is in the v7.0 sdk. Is there an tool in vs2010 to tell me the chain of includes? – Martin Beckett May 03 '11 at 19:19
  • 1
    @Steve - judicious use of WIN32_LEAN_AND_MEAN and this answer http://stackoverflow.com/questions/1137966/displaying-the-include-hierarchy-for-a-c-file-in-visual-studio - now I just have to persuade the library to fix their includes! – Martin Beckett May 03 '11 at 19:33
  • It's a maze alright. In the meantime I am adding +1 to your question, since I did not know about the annoyance tag before today. Thx. – Steve Townsend May 03 '11 at 19:35
  • I suggest you stay away from the C# and ".NET" framework, as you may need therapy if you do. ;-) I'm already proving to my management all the functional cr*p that is ".NET" and not my program; such as the Serial Port. – Thomas Matthews May 03 '11 at 19:55
  • 1
    Identifiers like *small* were chosen back in the early 90s by the Distributed Computing Environment standard, created by the Open Software Foundation. A group of, drumroll, Unix vendors. The group is still around, now named The Open Group. – Hans Passant May 03 '11 at 20:54
  • @Hans - I wouldn't mind if they did things like _dcom_our_secretsauce_small - but 'small' is rather a common word. Plus a compiler message in a template saying that char isn't allowed in '< >' wasn't exactly helpfull – Martin Beckett May 03 '11 at 21:02
  • The preprocessor wasn't invented by Microsoft either. Complaining about this doesn't get you anywhere. Dropping RPC does, pick a higher level protocol. – Hans Passant May 03 '11 at 21:12
  • 4
    @Hans - I wasn't picking RPC. I was using a library that happened to include "windows.h". Including "windows.h" on a windows machine shouldn't break C++, redefining min, max was bad enough! – Martin Beckett May 03 '11 at 21:21

3 Answers3

3

You didn't say whether you wanted to get rid of the header include or of #define.

If you want to get rid of the include but don't know where, you could try to define the include flag in your header above where the SDK includes are listed.

#define RpcNdr.h //find the real flag in the header
#include "sdk.h"

If it is just the #define of 'small', then how about putting this in your headers right after the list of SDK includes.

#ifdef RpcNdr.h //find the real flag in the header
#undef small 
Kelly S. French
  • 12,198
  • 10
  • 63
  • 93
  • A nice suggestion, but there is no guarantee that Microsoft will keep the header file or include guard symbols the same between SDKs and revisions of SDKs. – Thomas Matthews May 03 '11 at 19:57
  • 2
    although it's not really the solution (a savage beating for MSFT and the library writers) it's useful info so I accepted it. – Martin Beckett May 04 '11 at 15:18
2

This is part of the interface definition for the RPC NDR engine (for RPC and DCOM marshalling).

Steve Townsend
  • 53,498
  • 9
  • 91
  • 140
1

Well on my SDK it's described as "Definitions for stub data structures and prototypes of helper functions."

Steven
  • 2,538
  • 3
  • 31
  • 40