This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ... discard qualifiers ...
- To: <llewelly at 198 dot dsl dot xmission dot com>,Davide Libenzi <dlibenzi at maticad dot it>
- Subject: Re: ... discard qualifiers ...
- From: dlibenzi at maticad dot it (Davide Libenzi)
- Date: Sun, 2 Jan 2000 23:54:15 +0100
- Cc: gcc at gcc dot gnu dot org
- References: <Pine.LNX.4.10.10001021346550.490-100000@198.dsl.xmission.com>
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."