Advertisement
logicmoo

Ohad Asor of Tauchain/IDNI pretending he is C++ god.

Jan 15th, 2020
1,287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.69 KB | None | 0 0
  1. This Ohad Asor guy claims to be a C++ expert with many years experience.    
  2.  
  3. <naturalog> according to the standard, move() should leave a standard container empty
  4.  
  5. Ohad thinks move() moves the  removes elements to leave the container empty ?
  6.  
  7. when https://wandbox.org/permlink/trRijKZyq6XvZeLR clearly shows it doesn't
  8.  
  9.  
  10. //----------------------------- prog.cc ................................
  11. // This file is a "Hello, world!" in C++ language by GCC for wandbox.
  12. #include <iostream>
  13. #include <vector>
  14.  
  15. using namespace std;
  16.  
  17. class Data {
  18. public:
  19.     Data(const std::vector<int>& data): m_data(data) {}
  20.  
  21.     size_t size() const { return m_data.size(); }
  22.  
  23. private:
  24.     std::vector<int> m_data;
  25.  
  26. };
  27.  
  28. int main() {
  29.     std::vector<int> a = {1, 2, 3, 4, 5};
  30.  
  31.     std::cout << "a before: " << a.size() << std::endl;
  32.     auto b = Data(std::move(a));
  33.     std::cout << "a after: " << a.size() << std::endl;
  34.     std::cout << "b: " << b.size() << std::endl;
  35.  
  36.     return 0;
  37. }
  38. //----------------------------------------------------------------------------------------
  39.  
  40.  
  41. g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.72.0/gcc-9.2.0/include -std=c++11
  42. ./a.out
  43.  
  44.  
  45. a before: 5
  46. a after: 5
  47. b: 5
  48.  
  49.  
  50.  
  51. So Ohad decided it was a bug in the C++ compiler that would make the a.size() stay the same!   Yes, of course deny deny.  HE BLAMED THE C++ COMPILER!
  52.  
  53. I have written few as 20,000 lines of C++ over the years and *I* knew better.
  54.  
  55. When I quoted https://en.cppreference.com/w/cpp/utility/move he told me i was wrong.. lol (maybe his anger that i wont kiss his ass is what blinds him)
  56.  
  57.  
  58. The only thing worse than his incompetance would be his ego/arrogance [that makes him blame the compiler].
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement