Re: Trouble with variable types (void *)

From: Olaf Martens (olafmartens_at_arcor.de)
Date: 02/01/04


Date: Sun, 01 Feb 2004 16:43:04 +0100

Victor Bazarov schrieb:
> "Olaf Martens" <olafmartens@arcor.de> wrote in message
> news:401d0ec2$0$17562$9b4e6d93@newsread4.arcor-online.net...
>
>>Here's another problem that appeared recently:
>>
>>I have the following function call:
>>
>>l_test->Compress(&"filename.dat",l_buf);
>
>
> What's the "&" for?
g++ would complain otherwise and issue a warning: Deprecated conversion of
string constants to char *...
>

[snip]

>
> Drop the ampersand.
It's the second parameter that bothers me, not the first!
>
>

[snip]

>
> No, you missed the fact that you're not supposed to take addresses
> of literals.
Oh, really? And why does g++ complain when omitting the &, then?
So, once more: The problem is *NOT* the string literal, but the second
parameter (l_buf)!!!

-- 
Olaf Martens               Linux User #246244    http://counter.li.org/
Hugo-Luther-Str. 8         E-Mail: olafmartens@arcor.de
38118 Braunschweig         Fon: +49-531-314834
"Who the heck is General Failure, and why is he reading my harddisk?"


Relevant Pages

  • Re: Szell Marriage of Figaro Ov and WAM Sym # 28
    ... one complain so much, maybe you're having hardware issues. ... use a RTA and then you can see it. ...
    (rec.music.classical.recordings)
  • Re: Scooter Libby wrote *what*?
    ... >Where did I ever complain about that? ... >The less sexual conservatives are, the less likely they are to ... Mark Hickey ...
    (rec.bicycles.tech)
  • Re: ANN An ansic90 version of lcc-win
    ... develop a version of lcc-win that does complain 100%, ... that lcc-win does not conform to C90. ... that you've now fixed that problem and can supply a conforming C90 ...
    (comp.lang.c)
  • Re: Adding images to a listview
    ... to look like and who cares anyway? ... It might be bad that the improvements were needed at all, but I find it hard to complain that a large number of problems are being fixed. ... It's rediculous in my eyes that applying the fix will need several gigabytes of temporary storage space and several hours of processing. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: How does printf able to receive a pointer when passing it a string constant?
    ... Because they are string constants and you are trying to modify the ... printf; ... Because printf only reads from the pointer, it doesn't modify it. ...
    (perl.beginners)