T
Tech07
Why can't I change them? Apparently someone is walking the fence and doesn't
know. Hmm? Ask him! (BTW, I know why).
know. Hmm? Ask him! (BTW, I know why).
Why can't I change [string literals]?
Because a string literal is a "const char[]"Nick said:you should try to make your posts "standalone". Please include the
subject in the
body of your post.
Why can't I change [string literals]?
because the standard says it is undefined behaviour to modify a string
literal.
Many platforms take advantage of this and put string literals in ROM
or other
read-protected address space.
<snip Tech gibberish>
Nick said:On 12 Oct, 07:21, "Tech07" <[email protected]> wrote:Why can't I change [string literals]?because the standard says it is undefined behaviour to modify a string
literal.
Many platforms take advantage of this and put string literals in ROM
or other read-protected address space.<snip Tech gibberish>
Because a string literal is a "const char[]"
Because a string literal is a "const char[]"
Because a string literal is a "const char[]"
Nick said:you should try to make your posts "standalone". Please include the
subject in the
body of your post.
Why can't I change [string literals]?
because the standard says
it is undefined behaviour to modify a string
literal.
Many platforms
take advantage of this and put string literals in ROM
or other
read-protected address space.
<snip Tech gibberish>
Nick said:snipped PGP stuff
Nick said:On 12 Oct, 07:21, "Tech07" <[email protected]> wrote:Why can't I change [string literals]?because the standard says it is undefined behaviour to modify a
string literal.
Many platforms take advantage of this and put string literals in ROM
or other read-protected address space.<snip Tech gibberish>
Because a string literal is a "const char[]"
no it isn't. A string is still a char* but it is undefined behaviour
to modify it. C++ may have different rules but these are the C rules.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.