Re[5]: Чем плох Паскаль?
От: AlexRK  
Дата: 14.06.19 11:32
Оценка:
Здравствуйте, netch80, Вы писали:

N>в if, else, while нужно строить блок вокруг нескольких предложений, а в repeat-until — нет


В Ц/Ц++ то же самое — в do надо обязательно ставить {}, а в других местах — нет.

N>в конце main надо ставить точку после end, а у остальных — точку с запятой


Дааа... в других-то языках все иначе, да?

The main function has several special properties:
1) It cannot be used anywhere in the program
a) in particular, it cannot be called recursively
b) its address cannot be taken
2) It cannot be predefined and cannot be overloaded: effectively, the name main in the global namespace is reserved for functions (although it can be used to name classes, namespaces, enumerations, and any entity in a non-global namespace, except that a function called "main" cannot be declared with C language linkage in any namespace (since C++17))
3) It cannot be defined as deleted or declared with C language linkage (since C++17), inline, static, or constexpr
4) The body of the main function does not need to contain the return statement: if control reaches the end of main without encountering a return statement, the effect is that of executing return 0;.
5) Execution of the return (or the implicit return upon reaching the end of main) is equivalent to first leaving the function normally (which destroys the objects with automatic storage duration) and then calling std::exit with the same argument as the argument of the return. (std::exit then destroys static objects and terminates the program)
6) (since C++14) The return type of the main function cannot be deduced (auto main() {... is not allowed)


N>что var идёт перед основным телом


Просто другой подход.

N>что and и or почему-то приоритетнее сравнений


А почему должно быть наоборот?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.