Guest User

Untitled

a guest
May 25th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. $ ../cpla.sh p135-2
  2. $ clang++ p135-2.cpp -std=c++03 -Wall
  3. p135-2.cpp:14:13: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
  4. for (int& x : array){
  5. ^
  6. 1 warning generated.
  7. x=2
  8. x=4
  9. x=6
  10. x=8
  11. x=10
  12. C++N4741(68)9.5.4 The range-based for statement [stmt.ranged]p135-2.cpp
  13. $ clang++ p135-2.cpp -std=c++2a -Wall
  14. x=2
  15. x=4
  16. x=6
  17. x=8
  18. x=10
  19. C++N4741(68)9.5.4 The range-based for statement [stmt.ranged]p135-2.cpp
  20.  
  21. $ g++-8 p135-2.cpp -std=c++03 -Wall
  22. p135-2.cpp: In function 'int main()':
  23. p135-2.cpp:14:15: warning: range-based 'for' loops only available with -std=c++11 or -std=gnu++11
  24. for (int& x : array){
  25. ^~~~~
  26. p135-2.cpp:15:3: warning: 'x' is used uninitialized in this function [-Wuninitialized]
  27. x *= 2;
  28. ~~^~~~
  29. ../cpla.sh: line 17: 4884 Bus error: 10 ./$1g03 $2
  30.  
  31. $ g++-8 p135-2.cpp -std=c++2a -Wall
  32. x=2
  33. x=4
  34. x=6
  35. x=8
  36. x=10
  37. C++N4741(68)9.5.4 The range-based for statement [stmt.ranged]p135-2.cpp
Add Comment
Please, Sign In to add comment