Crossware

Table of Contents        Previous topic       Next topic       

C/C++ COMPILER->C Language Definition->1999 ANSI C Support

The C compiler supports a few features from the 1999 ANSI C Standard including:

The  // characters mark the start of a comment which extends to the end of the line.

Variables with can be defined anywhere within a block, not just at the beginning.

Variables can be defined within the initialising expression of a for loop.  Eg:

    for (int i = 0; i < 10; i++)
    {
    }

The scope of such variables ends at the end of the for statement.

In addition, the compiler supports the C++ feature that allows variables to be defined within the conditional expressions of the for loop, the while loop, if statement and the switch statement.  For example:

    for (int m = 0, g = 0; int j = f(); m++)
    {
    }

    while (int i = f())
    {
    }

    if (int i = f())
    {
    }
    else
    {
    }

    switch (int i = f())
    {
    }

The scope of such variables ends at the end of the controlled statement.  For the if/else construct the scope extends into the else block.