Semicolon in C++?

后端 未结 9 1613
心在旅途
心在旅途 2020-12-16 11:07

Is the \"missing semicolon\" error really required? Why not treat it as a warning?

When I compile this code

int f = 1
int h=2;

the

9条回答
  •  失恋的感觉
    2020-12-16 11:50

    +1 to you both.

    The semi-colon is a command line delimiter, unlike VB, python etc. C and C++ ignore white space within lines of code including carriage returns! This was originally because at inception of C computer monitors could only cope with 80 characters of text and as C++ is based on the C specification it followed suit.

    I could post up the question "Why must I keep getting errors about missing \ characters in VB when I try and write code over several lines, surely if VB knows of the problem it can insert it?"

    Auto insertion as has already been pointed out could be a nightmare, especially on code that wraps onto a second line.

提交回复
热议问题