This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ... discard qualifiers ...


On Sun, 02 Jan 2000, llewelly@198.dsl.xmission.com wrote:
> On Sun, 2 Jan 2000, Davide Libenzi wrote:
> 
> > 
> > Hi guys,
> > 
> > is there a way other than '-fwritable-strings' to avoid errors in this case :
> > 
> > void foo(const void * p)
> > {
> > ...
> > }
> > 
> > main()
> > {
> > 
> > 	foo( "Hello world !" );
> > 
> > }
> > 
> gcc 2.95.2 does not generate any errors for the above code (once the '...'
>   is commented out); in both C and C++, 'char const*' (the type of a
>   string literal) can be implicitly converted to 'void const*' (foo's
>   parameter type).
> 
> I don't know what -fwritable-strings has to do with any of this.
> 
> Perhaps you need to re-phrase your question.

Ops ...

I've translated a step ahead the code. This is the real one :

typedef void * Pointer;

void foo(const Pointer p)
{
...
}

void main()
{
	foo( "Hello World !" );
}

Cheers,
	Davide.

-- 
"Debian, the freedom in freedom."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]