Skip to content

Instantly share code, notes, and snippets.

@retep998
Created February 13, 2014 00:49
Show Gist options
  • Save retep998/8967622 to your computer and use it in GitHub Desktop.
Save retep998/8967622 to your computer and use it in GitHub Desktop.
An example of valid C++ code that results in implementation defined behavior at best, undefined at worst.
#include <iostream>
struct foo {
double bar;
};
void func(foo x) {
std::cout << x.bar;
}
#include <iostream>
struct foo {
long long bar;
};
void func(foo);
int main() {
foo lol;
lol.bar = 5;
func(lol);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment