Skip to content

Instantly share code, notes, and snippets.

@eu90h
Last active April 9, 2017 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eu90h/6526bb2dcef4798d19380a03cbd87f44 to your computer and use it in GitHub Desktop.
Save eu90h/6526bb2dcef4798d19380a03cbd87f44 to your computer and use it in GitHub Desktop.
Example program used to examine string layouts for this article: https://eu90h.github.io/cpp-strings.html
// Compile with -O3
#include <string>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
string greeting("Hello, ");
string name = argv[1];
cout << greeting.append(name) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment