[Live-devel] Compiler warnings

Ross Finlayson finlayson at live555.com
Fri Apr 3 08:06:42 PDT 2009


>>Working on a idea for a project and compiled up live on my Fedora 
>>10 box, with gcc version 4.3.2
>>
>>Noticed a tone of warnings such as ...
>>"warning: deprecated conversion from string constant to 'char*'"
>>
>>This is from passing a "string" to a function that's expecting a 
>>char*. Can be cleaned up in 2 ways
>>
>>1) "Fix" function prototypes from "char *" to "const char *" as appropriate
>>2) Add -Wno-write-strings to the CFLAGS in the Makefiles to 
>>suppress the warnings.
>>
>>Which would be deemed suitable Ross ?

Definitely 1).  If a string constant is being passed to a function, 
then that function's parameter should be decalred "char const*".


>Looking back at the archives, I see that Erik Hovland submitted a 
>big patch for something similar.

I remember *someone* submitting a patch for this, but it was bogus, 
because it replaced the string constants with heap-allocated copies 
of the strings (instead of just changing the function parameter 
declarations).

Just let me know the functions (and parameters) for which this is an 
issue (there probably aren't many of them), and I'll fix them.
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list