Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: const char* Message-ID: <16137@smoke.brl.mil> Date: 13 May 91 07:32:09 GMT References: <4278@rwthinf.UUCP> <16061@smoke.brl.mil> <1742@targon.UUCP> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 13 In article <1742@targon.UUCP> andre@targon.UUCP (Andre van Dalen) writes: >Does this mean that you can transform a const char * by calling a function? [...] >This would break the clean behaviour that can be forced through >the use of const pointers. Am I right here or did I miss something? You missed a lot! You don't need to call a function in order to convert type "const char*" to type "char *"; a cast will suffice. The "const" in the strchr() parameter type does not mean what you think it does, either. Finally, no "illegal" action occurs just by conversion of the pointer types, but rather only when the pointer to non-const is used in an attempt to modify what it points to, if what is pointed to is really a const-qualified object.