Created
February 13, 2014 00:49
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
struct foo { | |
double bar; | |
}; | |
void func(foo x) { | |
std::cout << x.bar; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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