Comment by worik

3 years ago

> Well, in C the visual indentation and the meaning of the code (given by {}) can diverge.

How?

The compiler doesn't check your indentation at all. (OK, not true, these days you get warnings for misleading indentation.) But here's an example of misleading indentation in C:

    if(some condition)
        do something; {
        do something else;
    }
    do another thing;

You can stretch 'some condition' out over multiple lines and have some more parents inside of it, to make it more confusing.

See also https://softwareengineering.stackexchange.com/a/16530

  • I see.

    Yes

    I class that as a bug in the original C specification

    • But you either make visual indentation significant, or you risk having a discrepancy between visual indentation and what the language sees.

      2 replies →