Skip to content

Instantly share code, notes, and snippets.

View drussel's full-sized avatar

Daniel Russel drussel

  • Velo3D
  • Palo Alto, CA
View GitHub Profile
@gkastrinis
gkastrinis / post1.md
Last active July 8, 2018 11:16
Unspecified (or undefined) behavior & sequence points in C++

Unspecified (or undefined) behavior & sequence points

Assume the following code snippet of test.cpp. Our goal was to read integers from stdin and map them to the order in which they first appeared in our input. Keep in mind this is just a test and probably there are better ways to implement the intended behavior of this cut-down version.

If we use g++ to compile our code we get the following output. This was not the output we were expecting.