I know that following is bad programming practice
char * p1 = "myBad" ;
The above is bad as const "myBad" memory is getting pointed by non Const pointer . Compilers allow p1 as to support backward compatibility with C
IS the following a bad practice too ?
char p2[]="myBadORGood";
Whats the difference betweeen p1 and p2 . DOes compiler make a non-const copy for p2 ? I think i read somewhere that p2 is fine but not sure ..
p1, actually. C++11 disallowedchar *pointing to string literals, and I'm very glad for it, as almost all cases of that were bugs.