, ( , ), C, char, const
.
const_cast
, , workaroud litteral char *
const char *
, , , . , , , .
, , K & R C (const ) , , .
My opinion is that this was acceptable several years or decades ago, when many third-party codes were not used const
in the signature, and the constant repetition const_cast
was really boring, but I now agree with the quote: I can’t imagine a legitimate reason to write at present char * p = "abc";
, and not (gardens retro retro)char * p = (char *) "abc";
source
share