|
-
Nov 11th, 2002, 08:42 AM
#25
Monday Morning Lunatic
Originally posted by CornedBee
Code:
#include <string>
using std::string;
string s("Hello there");
// dumdidum
// cast, else compiler error
char * cs = (char *)s.c_str();
If you now modify cs you have problems again. Casting away const is never good and means that something with your code design is wrong. The const modifier is really great.
I don't think you're allowed that last one, I thought you needed const_cast It might have changed though.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|