Knowing other important options in the GCC C++ compiler

GCC supports ISO C++ 1998, C++ 2003, and also C++ 2011 standard in version 4.9.2. Selecting this standard in GCC is done using one of these options: -ansi, -std=c++98, -std=c++03, or –std=c++11. Let's look at the following code and give it the name hash.cpp:

/* hash.cpp */
#include <iostream>
#include <functional>
#include <string>
int main(void) {
  std::string plainText = "";
  std::cout << "Input string and hit Enter if ready: ";
  std::cin >> plainText;
  std::hash<std::string> hashFunc;
  size_t hashText = hashFunc(plainText);
  std::cout << "Hashing: " << hashText << "\n";
  return 0;
}

If you compile and run the program, it will give you a hash number for every plain text user input. However, it ...

Get Boost.Asio C++ Network Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.