C / C ++ management structure limitations?

I heard about the limitation in VC ++ (not sure which version) about the number of nested operators if(somewhere in the stadium 300). The code was of the form:

if (a) ...
else if (b) ...
else if (c) ...
...

I was surprised to learn that there is a limit to this kind of thing and that the limit is so small. I am not looking for comments about coding practice and why to avoid it at all.

Here is a list of things that I could imagine could :

  • The number of functions in the scope (global, class, or namespace).
  • The number of expressions in a single expression (for example, compound legend).
  • The number of cases in the switch.
  • The number of parameters for the function.
  • The number of classes in one hierarchy (either inheritance or containment).

/ ? (, )? - , , /?

EDIT: , if "". :

if (a) { //...
}
else {
    if (b) { //...
    }
    else {
        if (c) { //...
        }
        else { //...
        }
    }
}
+3
4

Visual ++

++ . Visual ++ . - - Visual ++:

  • , [256] (256).

  • [256] (127).

  • [256] (127).

  • ( ) [65536] (65535).

  • , struct-declaration-list [256] (16).

  • [6144] ( 600, , /Zm ).

  • [256] (127).

  • [1024] (10).

  • [1024] (64).

+11

- (, )?

, . , , - , .

: B - , :

. . , .

+6

C , , . - 127 . (5.2.4.1 ISO/IEC 9899: 1999)

C , , 127 , ; -. , , , .

, 127 , , , , , , .

+3

, , ++:

int main() {
    if ( int x = 1 ) {
    }
    else if ( int x = 2 ) {
    }
}

, if else . , , , :

The compiler cares a great deal about scope. 

, , , , , .

+3

Source: https://habr.com/ru/post/1729602/


All Articles