I have recently started working with the vtk package and I see this odd notation that they include ;
after closing curly braces }
. Here is an example from vtkUnstructuredGrid.h
// Description:
// Standard vtkDataSet API methods. See vtkDataSet for more information.
int GetDataObjectType() {return VTK_UNSTRUCTURED_GRID;};
It's not needed and QtCreator also correctly detects this by saying extra ;
when parsing the code. I'm curious what could be the reason for this? Maybe readability?
Do not use a semicolon on the same line as an if , for , or while statement because it typically indicates programmer error and can result in unexpected behavior.
As with all statements in C, the break statement should terminate with a semicolon ( ; ).
Semicolons are end statements in C. The Semicolon tells that the current statement has been terminated and other statements following are new statements.
Sometimes the parenthetical material is part of a longer sentence part that will be set off by a comma, colon, or semicolon. These pieces of punctuation always come after the parenthetical material, never before it or inside the parentheses.
As QtCreator correctly detects, that is definitely an extra semicolon that not only is useless, but can also cause compiler warnings and confusion.
For example GCC with the -Wpedantic
flag will trigger:
warning: extra ';'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With