Linked by martini on Tue 23rd Oct 2012 22:02 UTC
Thread beginning with comment 540339
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.
Features
Linked by Thom Holwerda on 06/13/13 14:35 UTC
Linked by Thom Holwerda on 06/11/13 17:07 UTC
Linked by Thom Holwerda on 06/10/13 23:13 UTC
Linked by Thom Holwerda on 06/08/13 14:57 UTC
Linked by Thom Holwerda on 06/07/13 11:40 UTC
Linked by Thom Holwerda on 06/04/13 12:45 UTC
Linked by nfeske on 05/31/13 10:12 UTC
Linked by Thom Holwerda on 05/29/13 16:59 UTC
Linked by Thom Holwerda on 05/24/13 17:26 UTC
Linked by Thom Holwerda on 05/21/13 21:38 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