Like Tree12Likes
  • 1 Post By Elysia
  • 6 Post By phantomotap
  • 1 Post By CommonTater
  • 1 Post By kmdv
  • 1 Post By CommonTater
  • 2 Post By kmdv

Microsoft ruins my code

This is a discussion on Microsoft ruins my code within the Windows Programming forums, part of the Platform Specific Boards category; So, today I was writing a DirectX application (thus being forced to include windows stuff). Everything was working as expected, ...

  1. #1
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    682

    Microsoft ruins my code

    So, today I was writing a DirectX application (thus being forced to include windows stuff). Everything was working as expected, when suddenly, from nowhere, a terrifying error appeared near variable declaration:

    Code:
    Com::FontPtr small = Dxlib::Text::Font(Target.GetDevice(), "Courier New", 14, true);
    menu.cpp|53|error: expected unqualified-id before '=' token|

    I had absolutely NO idea what could be wrong until I traced possible declaration of 'small' identifier and found this:

    Header: rpcndr.h (windows one)
    Line: 51
    Code: #define small char

    I am posting this as a warning for anyone who attempts to touch win headers. There are other, equally stupid defines.
    I never put signature, but I decided to make an exception.

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,209
    Yes, this is one of the reasons why defines are generally a bad idea, and especially when you start to define rather "normal" things that may very well end up being used by somebody else in some entirely different context. And yes the WinAPI is riddled with different defines.

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    I'm guessing you wanted Com::FontPtr.small or some such...

    Of late I've taken to using longer more bizarre names for stuff... pSmallFontStyle ... things like that just to avoid these kinds of things and even then I run into the occasional collision... Microsoft strikes again!

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,992
    I blame C and its define madness.
    Phenom likes this.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,402
    Do you blame cars for drunk drivers?

    Soma

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,992
    Hehe, don't take it seriously. It's more of a joke than seriousness.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by phantomotap View Post
    Do you blame cars for drunk drivers?

    Soma
    But if there were no cars, there would be no drunk drivers.

    (And, about 1/10th the current rate of asthma.)
    MK27 likes this.

  8. #8
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    682
    Quote Originally Posted by CommonTater View Post
    But if there were no cars, there would be no drunk drivers.

    (And, about 1/10th the current rate of asthma.)
    This smells of socialism...

    I am wondering if the guy who dared to add this definition still works for Microsoft.
    I never put signature, but I decided to make an exception.

  9. #9
    language hopper dennis.cpp's Avatar
    Join Date
    Jan 2011
    Location
    Herborn, Hesse, Germany
    Posts
    197
    Quote Originally Posted by kmdv View Post
    This smells of socialism...
    I read a lot of socialist classics, but I never came across anything related to cars, drunk driving, or asthma.

  10. #10
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    682
    Quote Originally Posted by dennis.cpp View Post
    I read a lot of socialist classics, but I never came across anything related to cars, drunk driving, or asthma.
    Welcome to the forums.

    So, you probably do not understand the basis of socialism. Shortly: it is not about cars, drinking, or asthma, it is about the way of thinking and "solving" problems. Solving is enclosed in double quotes because the effect is usually counter-productive. In socialism the goverment needs to take money from the rich and to give it to the poor. The whole trick is to make people forget about paying and focus their attention on taking. People who cannot think logically are convinced that the goverment gives them more than take. Indeed, this can be true for principle, but not when it comes to the society as a whole. So, you must have a reason to take money; fumes, CO2 emmision, and such not environment-friendly can be one. I live in a country, which was affected by socialism very much in the past, and still is, but just under another name.
    rags_to_riches likes this.
    I never put signature, but I decided to make an exception.

  11. #11
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Wow... aren't you the humourless bunch!

    How in the h__l do you get from a joke about blaming cars for drunk drivers all the way to the far end of socialist theory...

    My lord people.
    kmdv likes this.

  12. #12
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    682
    Quote Originally Posted by CommonTater View Post
    Wow... aren't you the humourless bunch!

    How in the h__l do you get from a joke about blaming cars for drunk drivers all the way to the far end of socialist theory...

    My lord people.
    Blame Microsoft, they started this (:
    I never put signature, but I decided to make an exception.

  13. #13
    language hopper dennis.cpp's Avatar
    Join Date
    Jan 2011
    Location
    Herborn, Hesse, Germany
    Posts
    197
    Quote Originally Posted by CommonTater View Post
    Wow... aren't you the humourless bunch!

    How in the h__l do you get from a joke about blaming cars for drunk drivers all the way to the far end of socialist theory...

    My lord people.
    Haha, you're maybe right. One more serious thing though: What kmdv says is not at all any socialist theory, but a very superficial understanding of socialism probably based on soviet or cuban reality. However, since this is a programming board and this is only my second post, I should not deepen this but get myself to start posting on-topic. Thus: I'm out of the thread.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing char* to function ruins data?
    By CodeMonkey in forum C++ Programming
    Replies: 8
    Last Post: 07-17-2003, 03:50 PM
  2. Microsoft Bob
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 11-04-2002, 02:53 PM
  3. How I Can get the source code of Microsoft Windows?
    By hadizadeh in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 12-16-2001, 10:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21