Probably a bug in C++

Правка en2, от Igor_Parfenov, 2022-09-11 13:36:21
Code1

Look at this code. It seems, the expected output is always 1. However, in

  • Codeforces
    • G++20
    • G++17
    • G++14
    • VC++2017
  • in my local Windows G++ 8.1.0
  • in my local Debian G++ 10.2.1

the output is always 0. In Codeforces::Clang++17 & Clang++20 the output is

Clang++
Code2

Now look at this code. Here in all previously mensioned compilers (including Clang++) the output is always 1.

How found
Теги c++, gnu c++, ms visual c++, clang, undefined behavior, compilers

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Igor_Parfenov 2022-09-11 13:36:21 7
en1 Английский Igor_Parfenov 2022-09-11 12:47:22 2362 Initial revision (published)