const char*

Andre van Dalen andre at targon.UUCP
Mon May 13 01:31:14 AEST 1991


In article <16061 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
>In article <4278 at rwthinf.UUCP> berg at marvin.e17.physik.tu-muenchen.de (Stephen R. van den Berg) writes:
>>What to do with the following program?
>The same thing as in the strchr() implementation I just posted.

Does this mean that you can transform a const char * by calling a function?
like:

char * un_const (const char *p)
{
	return (char *)p;
}

void do_something(const char *read_only)
{
	char *foo = un_const(read_only);

	*foo = '\0';
}

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?

-- 
The mail|    AAA         DDDD  It's not the kill, but the thrill of the chase.
demon...|   AA AAvv   vvDD  DD        Ketchup is a vegetable.
hits!.@&|  AAAAAAAvv vvDD  DD                    {nixbur|nixtor}!adalen.via
--more--| AAA   AAAvvvDDDDDD    Andre van Dalen, uunet!hp4nl!targon!andre



More information about the Comp.std.c mailing list