c++11 - c++ 14 vs 11 - sizeof return different value? -


for same program c++11 return 2 1 2, c++14 return 2 1 1 me. confused..

#include <iostream> #include <string> using namespace std; int main() {     char a[2];    cout << sizeof(a) << endl;      std::string b("a");    cout << b.size() << endl;      char c[b.size() + 1];    cout << sizeof(c) << endl;     return 0; } 

char c[b.size() + 1]; not allowed in standard c++, version.

if find compiler accepts compiler extension, should consult documentation whichever compiler used.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -