Блог пользователя NoCommander

Автор NoCommander, история, 16 месяцев назад, По-английски

217414890

217414841

The above two codes only differ in the submission language.But one gets Accepted,the other gets Wrong answer on test 1.

wrong output format Expected integer, but "?" found (test case 1)

In C++14,it did f(1, n) first and did cout << "! " next.

In C++17,it did cout << "! " first and did f(1, n) next.

Before C++17, the order of << was not specified.

update:Thanks to balalaika,more clearly,A << B << C,A,B and C can be evaluated in any order.

  • Проголосовать: нравится
  • +33
  • Проголосовать: не нравится

»
16 месяцев назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

orz.

»
16 месяцев назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

Some stupid correction:

Order of << was sure always specified in all standards (A << B << C is always (A << B) << C and nothing else), but A , B and C before C++17 can be evaluated in any order.

In C++17 there is line that clarifies that A must be fully evaluated before start of evaluation of B (and so about A << B and C). https://timsong-cpp.github.io/cppwp/n4659/expr.shift#4