🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2876

Re: const char*

#2876
From: Andre van Dalen
Date: Sun, 12 May 1991 15:31
28 lines
1394 bytes
In article <16061@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes:
>In article <4278@rwthinf.UUCP> berg@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
Technical Details
Message-ID: <1742@targon.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!uunet!mcsun!hp4nl!targon!andre
References: <4278@rwthinf.UUCP> <16061@smoke.brl.mil>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!uunet!mcsun!hp4nl!targon!andre
From: andre@targon.UUCP (Andre van Dalen)
Newsgroups: comp.std.c
Subject: Re: const char*
Message-ID: <1742@targon.UUCP>
Date: 12 May 91 15:31:14 GMT
References: <4278@rwthinf.UUCP> <16061@smoke.brl.mil>
Organization: Siemens Nixdorf Informationsystems BV.,SWZ, Vianen, the Netherlands.
Lines: 28