3 ms·
Here is some example code showing the problem: http://pastebin.com/6wu7bcrF http://pastebin.com/6wu7bcrF I compiled it using both: g++ -std=c++14 -Wall
by mike-cardwell 12y ago
Here is some example code showing the problem:
http://pastebin.com/6wu7bcrF http://pastebin.com/6wu7bcrF
I compiled it using both:
g++ -std=c++14 -Wall -Wextra -g test.cpp -o test
clang++ -std=c++14 -Wall -Wextra -g test.cpp -o test
GCC v4.9.1 and Clang v3.5.0.
Under neither case did it supply any warnings at compile time. In both cases it segfaults when it hits the second std::cout whilst running.
- tomjakubowski 12y agoSince that's undefined behavior anything (including and especially things worse than a segmentation fault) could happen.
- deleted 12y ago[deleted]
- pjmlp 12y agoStill, those are just two among many.
- beached_whale 12y ago-Weverything on clang is what you want
- mike-cardwell 12y agoThat's a useful option to know, thanks. However, it still didn't detect the problem being discussed.