← Back to context

Comment by MrDresden

3 years ago

The point still stands that this is an inherit possibility in the language it self.

Well, in C the visual indentation and the meaning of the code (given by {}) can diverge. That's even worse, and happens in practice. Many style guidelines for C have evolved specifically to address that problem with 'the language itself'.

  • > 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

      4 replies →

I think its more of an tooling issue. If your editor / diff viewer cant differentiate between different whitespaces get a better one. Also if you want to ensure some function isnt in local scope etc just test it.