Re: Vexing GCC warnings: "assignment discards qualifiers from pointer target type"

From: CBFalconer (cbfalconer_at_yahoo.com)
Date: 01/03/04


Date: Fri, 02 Jan 2004 23:42:14 GMT

Peter Pichler wrote:
>
... snip ...
>
> Seriously, string literals in C have a type char[], not const
> char[] as one would expect when trying to modify them causes a UB.
> GCC probably realizes that and tries to prevent you from doing
> something stupid by warning about returning a string literal as
> char * without const.

He specifically told it to with -Wwrite-strings.

-- 
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


Relevant Pages