Creating a problem with MSVS 2010 and the C ++ standard

I am trying to build using msvs 2010 a project found in the following git:

https://github.com/Joonhwan/exprtk

The problem is that when I comment on line 48 '#define exprtk_lean_and_mean' in the exprtk.hpp file, I get the following compiler error:

Error 1 error C1128: number of sections exceeded object file format limit : compile with /bigobj 

The error when starting the error seems to indicate that the compiled translation unit is compiled into something more than the limit for arbitration, and adding "bigobj" to the command line should fix the problem (which it does). Compiling code with gcc (4.3) works without crashing.

My questions:

  • Does C ++ limit the number of types that can be written in a translation block?

  • Is there a way to write code in this bad project practice? (when in googling I noticed that many boost libraries have the same problem, for example: Boost.Sprit)

+8
c ++ standards visual-c ++ compiler-errors
source share
2 answers

Does C ++ provide a limit on the number of types that can be set in a translation block?

Note that the maximum values ​​of such parameters remain open to specific implementations. The standard only establishes the minimum requirements that must be supported by the implementation. The implementation will document the maximum values ​​that it supports, in which case the MSVC implementation does this.

They are defined in a special section of the C ++ standard.

Appendix B - Sales Volumes

  • Because computers are finite, C ++ implementations are inevitably limited in the size of the programs that they can be successfully processed. Each exercise should document these that are known. The documentation may indicate fixed limits where they exist, tell me how to calculate variable limits as a function of available resources, or say that fixed limits do not exist or are unknown.

  • Limits may limit quantities that include those described below or others. The number in square brackets, the following each quantity is recommended as a minimum for this quantity. However, these values ​​are only recommendations and do not determine compliance.
    - The investment levels of compound operators, iterative control structures, and selection control structures [256].
    - Nesting levels of conditional inclusion [256].
    - a pointer, an array, and function declarators (in any combination) that changes arithmetic, structure, union, or an incomplete type in a statement [256].
    - Embedding levels of expressions in parentheses in full expression [256].
    - The number of characters in the internal identifier or macro name [1,024].
    - The number of characters in the external identifier [1,024].
    - External identifiers in one translation unit [65] 536].
    - Identifiers with a block region declared in one block [1,024].
    - Macro identifiers simultaneously defined in one translation unit [65 536].
    - Parameters in one function definition [256].
    - Arguments in one function call [256]. **
    - Parameters in one macro definition [256].
    - Arguments in a single macro call [256].
    - Characters in one logical source line [65,536].
    - Characters in a character string literal or wide string literal (after concatenation) [65] 536].
    - The size of the object [262 144] .
    - Nesting levels for #include files [256].
    - Shortcuts for the switch statement (excluding any nested switch statements) [16 384].
    - Data elements in one class, structure or association [16 384].
    - Enumeration constants in one enumeration [4 096].
    - Levels nested class, structure or union definitions in one struct-declaration-list [256].
    - Functions registered by atexit () [32].
    - Direct and indirect base classes [16 384].
    - Direct base classes for one class [1024].
    - Participants announced in one class [4,096].
    - The final redefinition of virtual functions into a class, available or not [16 384].
    - Direct and indirect virtual base class [1,024].
    - Static class members [1,024].
    - announcements of friends in the class [4 096].
    - Access control ads in the class [4 096].
    - Initializers of elements in the constructor definition [6 144].
    - Scope qualification of a single identifier [256].
    - Nested external specifications [1,024].
    - Template arguments in template declaration [1,024].
    - Recursively nested instance template [17].
    - Handlers in try block [256].
    - Throw specifications for a single function declaration [256].

+14
source share

The limitation is in the OBJ format used by older versions of MSVC and related linkers. Thus, although this restriction is arbitrary, it cannot be satisfied by default for new versions of compilers. Check out the description of the / bigobj option :

Linkers sent before Visual C ++ 2005 cannot read .obj files created with / bigobj.

+7
source share

All Articles