Linked by martini on Tue 23rd Oct 2012 22:02 UTC
Permalink for comment 540339
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.
Features
Linked by Thom Holwerda on 05/18/13 21:33 UTC
Linked by David Adams on 05/16/13 4:23 UTC
Linked by Thom Holwerda on 05/11/13 21:41 UTC
Linked by Thom Holwerda on 05/08/13 14:22 UTC
Linked by Thom Holwerda on 05/02/13 15:28 UTC
Linked by Thom Holwerda on 04/29/13 21:06 UTC
Linked by Thom Holwerda on 04/24/13 22:24 UTC
Linked by Thom Holwerda on 04/18/13 11:21 UTC
Linked by Thom Holwerda on 04/16/13 9:29 UTC
Linked by Thom Holwerda on 04/15/13 22:44 UTC
More Features »
Sponsored Links



Member since:
2009-08-05
void f() {
a[0]++; // segfault?
}
So, undefined behavior in C++, segfault if your compiler puts string data in readonly memory (true for Intel's C++ compiler and GCC, but not MSVC).
EDIT: need more coffee - your code is OK since it copies the the string literal into the non-const 'a' char array and assigns a pointer to that, rather than directly to the string literal.
Edited 2012-10-28 16:16 UTC