Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio 2015 & .NET 4.6
  4. How to suppress non-standard conform macros in VS 2015 system headers?

How to suppress non-standard conform macros in VS 2015 system headers?

Scheduled Pinned Locked Moved Visual Studio 2015 & .NET 4.6
questionc++visual-studioarchitecturehelp
8 Posts 4 Posters 25 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stefan_Lang
    wrote on last edited by
    #1

    I'm currently trying to move our applications from VS 2010 to VS 2015. I found that one of the first issues was caused by a non-standard conformant macro, INFINITY, #defined in math.h. I couldn't help noticing that there are quite a few such macros hiding there and possibly elsewhere, that do not conform to the standard of using a leading '_'! I don't want VS system headers to clutter our namespace, let alone cluttering it with macro symbols leading to inexplicable and hard to locate errors! So, my question is: is there a way to suppress these macro definitions? In the past, I've already used #define NOMINMAX (another nonstandard symbol:mad:) to prevent the system min/max #defines to clash with member functions of the stl class valarray! So I wondered whether there is a similar switch to suppress other such macros?

    GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

    D D 강 3 Replies Last reply
    0
    • S Stefan_Lang

      I'm currently trying to move our applications from VS 2010 to VS 2015. I found that one of the first issues was caused by a non-standard conformant macro, INFINITY, #defined in math.h. I couldn't help noticing that there are quite a few such macros hiding there and possibly elsewhere, that do not conform to the standard of using a leading '_'! I don't want VS system headers to clutter our namespace, let alone cluttering it with macro symbols leading to inexplicable and hard to locate errors! So, my question is: is there a way to suppress these macro definitions? In the past, I've already used #define NOMINMAX (another nonstandard symbol:mad:) to prevent the system min/max #defines to clash with member functions of the stl class valarray! So I wondered whether there is a similar switch to suppress other such macros?

      GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

      D Offline
      D Offline
      Dr Gadgit
      wrote on last edited by
      #2

      Please come back to VS 2010 or I will be left all on my own. I remember the good old days of GOSUB, i live without them now thanks to static functions, i love em and use them far to much but i think others don't use them enought. Programing is not a science, it's a art if you are good at it

      S 1 Reply Last reply
      0
      • D Dr Gadgit

        Please come back to VS 2010 or I will be left all on my own. I remember the good old days of GOSUB, i live without them now thanks to static functions, i love em and use them far to much but i think others don't use them enought. Programing is not a science, it's a art if you are good at it

        S Offline
        S Offline
        Stefan_Lang
        wrote on last edited by
        #3

        In case I wasn't clear, I am talking of C/C++. Whether we move to VS 2015 is a matter of efficiency and C++ standards compliance. We need highly performant and reliable code, and the latest C++ features would help in both regards. Nostalgia is understandable, but entirely misplaced in our situation.

        GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

        1 Reply Last reply
        0
        • S Stefan_Lang

          I'm currently trying to move our applications from VS 2010 to VS 2015. I found that one of the first issues was caused by a non-standard conformant macro, INFINITY, #defined in math.h. I couldn't help noticing that there are quite a few such macros hiding there and possibly elsewhere, that do not conform to the standard of using a leading '_'! I don't want VS system headers to clutter our namespace, let alone cluttering it with macro symbols leading to inexplicable and hard to locate errors! So, my question is: is there a way to suppress these macro definitions? In the past, I've already used #define NOMINMAX (another nonstandard symbol:mad:) to prevent the system min/max #defines to clash with member functions of the stl class valarray! So I wondered whether there is a similar switch to suppress other such macros?

          GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

          D Offline
          D Offline
          Daniel Pfeffer
          wrote on last edited by
          #4

          VS2015 supports (almost all) of C++2011, and some of the candidate features for C++2014/2017. INFINITY is defined in C++2011 (in math.h / cmath). To my knowledge, there is no way to force VS2015 to compile to an earlier Standard. If you have multiple versions of Visual Studio installed you may select the toolset from earlier versions, but that's it. The latest C & C++ Standards have added many features, macros, and functions that did not exist in previous versions. You may wish to get the latest copy of the appropriate Standard. For various extensions, you may wish to try the "disable language extensions" option. In VS2012, it may be found in the Properties dialog, under C++|Language. I don't know what this will do to __declspec declarations and other extensions, however. I hope this helps.

          If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill

          S 1 Reply Last reply
          0
          • D Daniel Pfeffer

            VS2015 supports (almost all) of C++2011, and some of the candidate features for C++2014/2017. INFINITY is defined in C++2011 (in math.h / cmath). To my knowledge, there is no way to force VS2015 to compile to an earlier Standard. If you have multiple versions of Visual Studio installed you may select the toolset from earlier versions, but that's it. The latest C & C++ Standards have added many features, macros, and functions that did not exist in previous versions. You may wish to get the latest copy of the appropriate Standard. For various extensions, you may wish to try the "disable language extensions" option. In VS2012, it may be found in the Properties dialog, under C++|Language. I don't know what this will do to __declspec declarations and other extensions, however. I hope this helps.

            If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill

            S Offline
            S Offline
            Stefan_Lang
            wrote on last edited by
            #5

            Using the VS2010 compiler is not an option: the whole point of moving to VS 2015 are the new C++ features! As for standards, I've found this: http://pubs.opengroup.org/onlinepubs/9699919799/[^]:

            Quote:

            INFINITY A constant expression of type float representing positive or unsigned infinity, if available; else a positive constant of type float that overflows at translation time.

            and:

            Quote:

            The following macros shall be defined for number classification. They represent the mutually-exclusive kinds of floating-point values. They expand to integer constant expressions with distinct values. Additional implementation-defined floating-point classifications, with macro definitions beginning with FP_ and an uppercase letter, may also be specified by the implementation. FP_INFINITE

            Seems like VS 2015 doesn't adhere to either, whereas VS2010 didn't specify these constants at all (this standard spec was present at least as early as 2004). :mad: I've checked on cmath as an alternative, but unfortunately it doesn't help at all. I may need to specifically use either one or the other header in specific places, but that doesn't save us the potentially considerable effort of resolving numerous macro name clashes! Probably the best way to resolve this is search our codebase for symbols defined in math.h and rename them before moving to 2015. And then hope there aren't more headers introducing other conflicting macros...:~

            GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

            D 1 Reply Last reply
            0
            • S Stefan_Lang

              Using the VS2010 compiler is not an option: the whole point of moving to VS 2015 are the new C++ features! As for standards, I've found this: http://pubs.opengroup.org/onlinepubs/9699919799/[^]:

              Quote:

              INFINITY A constant expression of type float representing positive or unsigned infinity, if available; else a positive constant of type float that overflows at translation time.

              and:

              Quote:

              The following macros shall be defined for number classification. They represent the mutually-exclusive kinds of floating-point values. They expand to integer constant expressions with distinct values. Additional implementation-defined floating-point classifications, with macro definitions beginning with FP_ and an uppercase letter, may also be specified by the implementation. FP_INFINITE

              Seems like VS 2015 doesn't adhere to either, whereas VS2010 didn't specify these constants at all (this standard spec was present at least as early as 2004). :mad: I've checked on cmath as an alternative, but unfortunately it doesn't help at all. I may need to specifically use either one or the other header in specific places, but that doesn't save us the potentially considerable effort of resolving numerous macro name clashes! Probably the best way to resolve this is search our codebase for symbols defined in math.h and rename them before moving to 2015. And then hope there aren't more headers introducing other conflicting macros...:~

              GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

              D Offline
              D Offline
              Daniel Pfeffer
              wrote on last edited by
              #6

              VS2010 was compliant (more or less) to C++1998, and had (very partial) compliance to C1999. It is no wonder that these macros were not defined there. I've just checked my version of VS2015, and both INFINITY and the FP_XXX macros are defined (in math.h). I haven't run a C++ compliance suite on VS2015, but every C++2011 feature that I have looked for is there. If you want (need) the new language features, it appears that you are going to have to modify your code in order to support it. :(

              If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill

              S 1 Reply Last reply
              0
              • D Daniel Pfeffer

                VS2010 was compliant (more or less) to C++1998, and had (very partial) compliance to C1999. It is no wonder that these macros were not defined there. I've just checked my version of VS2015, and both INFINITY and the FP_XXX macros are defined (in math.h). I haven't run a C++ compliance suite on VS2015, but every C++2011 feature that I have looked for is there. If you want (need) the new language features, it appears that you are going to have to modify your code in order to support it. :(

                If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill

                S Offline
                S Offline
                Stefan_Lang
                wrote on last edited by
                #7

                As for compliance, MS does provide compatibility lists regarding the C++ standards, but for some it claims only partial compliance. And, it appears, even for those features they've officially implemented you may be in for a nasty surprise. :( Anyway, thanks for checking.

                GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

                1 Reply Last reply
                0
                • S Stefan_Lang

                  I'm currently trying to move our applications from VS 2010 to VS 2015. I found that one of the first issues was caused by a non-standard conformant macro, INFINITY, #defined in math.h. I couldn't help noticing that there are quite a few such macros hiding there and possibly elsewhere, that do not conform to the standard of using a leading '_'! I don't want VS system headers to clutter our namespace, let alone cluttering it with macro symbols leading to inexplicable and hard to locate errors! So, my question is: is there a way to suppress these macro definitions? In the past, I've already used #define NOMINMAX (another nonstandard symbol:mad:) to prevent the system min/max #defines to clash with member functions of the stl class valarray! So I wondered whether there is a similar switch to suppress other such macros?

                  GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

                  강 Offline
                  강 Offline
                  강남풀싸롱신세경실장
                  wrote on last edited by
                  #8

                  예리한눈으로바라본+_+예쁜여자비키니수영복들사진을올려볼께요.강남풀싸롱신세경팀장입장에서봤을때예쁜비키니들을엄선해서올려봤답니다.강남풀싸롱놀기전에추천맛집오늘뭐먹지걱정그만!※안쪽에있는수족관:날씬한대게랑통통한킹크랩이한가득입니다.게살죽한수 저~목넘김이부드럽네요점심대충때웠더니배곻픈내배~얼릉먹어줘야겠습니다.내가좋아하는랍스타등장~‪#‎강남풀싸롱추천‬대게맛집부족하지않게큰놈으로다가주문했어요살이가득찬게제대로올 려졌네요서빙하시는분이그자리에서가위같은걸이용해서하나씩먹기좋게분리해주시네요.\[강남풀싸롱맛집추천성신여대맛집테이스티로드에나온맛의진수☆]맛집블로거에게테이스트로드에나오는맛 집은한번은가야할꺼같은묘한의무감에휩싸이곤한다죠ㅎㅎ꼭한번방문해보고싶다는생각은늘했었는데날잡고가기가쉽지않더군요ㅠㅠ그러다마침성신여대쪽에갈일이생겨성신여대맛집고기의잔치에다녀왔 어요~방송에서의먹방모습이인상깊었는데드디어ㄷㄷㄷ빨간색이입맛을돋구는색이라는데입구서부터ㅋㅋ고기의잔치간판보고침부터훔냐훔냐~10.16경복대학교상황ㄷㄷ..몸매가‪#‎frie nd‬다받아요‪#‎강남풀싸롱‬‪#‎팔로우‬‪#‎좋아요‬+‪#‎공유‬+‪#‎뎃글은‬필수!!!‪#‎친구‬들도다소환강남풀싸롱언니실사풀살롱안내.역삼마카오&강남더블업언니들 총집합2015년1월삼성동으로이전10월포스코사거리에서연중무휴영업중.010-5946-5913신세경팀장

                  강남풀싸롱 대표미녀 신세결실장 매직미러 후훗^^ 강남풀싸롱1위 PLAY
                  비용문의 : 미녀실장 신세경♡ 010-5946-5913
                  동종업계 최고상위권 수질최고!! 플레이
                  비즈니스 접대, 화끈한 술자리,
                  동창모임, 직원모임, 바이어접대 등...
                  어떠한 경우에도 컨셉을 맞춰드립니다~! ^^
                  미리 연락주시면 그에 맞는 수위로 시스템 조절해드릴게요^^
                  Hot Place 플레이~!

                    -  룸타임 : 1시간 10분 > 침실 : 45분 
                    - 8시전 이벤트가 적용 
                        단체할인! (한분당 28만원씩!), 양주셋 맥주 음료 안주 무제한
                    - 8시이후 이벤트가
                        단체할인 (한분당 32만원씩!), 양주셋 맥주 음료 안주 무제한
                  
                  믿을 수 있는^^ 미녀실장 신세경실장♡!! 010-5946-5913  ^^
                  

                  ㅁㅁ

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups