Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Sep 2001 16:49:46 +0100
From:      David Malone <dwmalone@maths.tcd.ie>
To:        Mark Murray <mark@grondar.za>
Cc:        Maxim Sobolev <sobomax@FreeBSD.ORG>, markm@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/usr.bin/su Makefile su.c
Message-ID:  <20010906164946.A94377@walton.maths.tcd.ie>
In-Reply-To: <200109051017.f85AH2k99078@grimreaper.grondar.za>; from mark@grondar.za on Wed, Sep 05, 2001 at 11:17:01AM %2B0100
References:  <200109041844.f84Iijw98897@vega.vega.com> <200109051017.f85AH2k99078@grimreaper.grondar.za>

next in thread | previous in thread | raw e-mail | index | archive | help

> Now how do you get (variable) stuff into a 'const char *'?
> 
> For example -  a function is not allowed to modify its arguments, so
> they are const, but the stuff being passed in is by no means constant.
> That one is easy - you can pass a 'foo *' into a 'const foo *'. Now,
> how do you build up a 'const foo *' in such a way that you can, but
> nobody else can?

You build it up in a char * and then assign it to a const char *.
Or am I missing something? (There are some more compilcated issues
with constness with functions like strchr. It takes a const char
* and derives a char *, its return value, from it.)

	David.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010906164946.A94377>