Initializing const members of structs in C/C++… compiler dependent?

后端 未结 4 1770
春和景丽
春和景丽 2020-12-19 08:35

Recently I ran into a compiler error in a legacy environment using Borland C++ 5.2. I had a .cpp file which included a header from some C source which I don\'t control. The

4条回答
  •  抹茶落季
    2020-12-19 08:53

    Question 1:

    Compilers published at different times implement different versions of C++. They are different approximations to a standard. All have vendor-specific "additions", i.e. allow non-portable code.

    • BCC 5.2 was created before first C++ standard (ISO 14882:1998).
    • VC++2003 is close to ISO 14882:1998, but also has some deficiencies, especially concerning templates.
    • VC++2008 nearly implements ISO 14882:2003.

    Question 2:

    • Try to get a modern compiler to your legacy system, if it's 32bit Windows.
    • Try to compile on a modern machine and deploy the executable on your legacy system.
    • If the legacy system is 16bit Windows, I don't see a solution.

提交回复
热议问题