A new ISO Standard for C++ was issued in 2011 and has been implemented in the latest C++ compilers. I searched for an explanation of this standard after trying to compile a short C++ program that used
a structure containing a character string.
The compiler reported an error for both these statements:
char* mystring = "John";
string mystring = "John";
The error stated that ISO prohibited the initiation of a constant string.
There are still a lot of C++ books and a lot of C++ tutorials that implement this old style of initiating strings. And this is fine for people working with old compilers. However people working with new compilers or free on-line compilers will experience difficulties with the two C++ statements above as well as in other C++ statements.
I found a C++11 on-line reference at
C++11 Reference
The ISO 2011 C++ Standard costs about $30.00 to download. So I searched further and found a ISO 2011 C++ FAQ for which I provide the link below:
C++11 - the new ISO C++ standard
a structure containing a character string.
The compiler reported an error for both these statements:
char* mystring = "John";
string mystring = "John";
The error stated that ISO prohibited the initiation of a constant string.
There are still a lot of C++ books and a lot of C++ tutorials that implement this old style of initiating strings. And this is fine for people working with old compilers. However people working with new compilers or free on-line compilers will experience difficulties with the two C++ statements above as well as in other C++ statements.
I found a C++11 on-line reference at
C++11 Reference
The ISO 2011 C++ Standard costs about $30.00 to download. So I searched further and found a ISO 2011 C++ FAQ for which I provide the link below:
C++11 - the new ISO C++ standard
No comments:
Post a Comment