Strange cc warning

teittinen at cc.helsinki.fi teittinen at cc.helsinki.fi
Thu Feb 2 22:22:32 AEST 1989


In article <490 at marob.MASA.COM>, daveh at marob.MASA.COM (Dave Hammond) writes:
> when
> I switch to the next higher warning level (-W 2) the following completely
> unobvious warning appears:
> 
> .../include/dsipriv.h(88) : warning 74:
> 	non standard extension used - 'macro formals in strings'
>
> The macro in question is defined as follows:
> 
> /* copy IN to OUT for LEN chars, enclosing OUT in dbl. quotes */
> #define REQUOTE(in, out, len) if ((in) && (out)) {	\
> 				*(out) = '"';	\
This is wrong ---------------------------^^^
> Line 88 --------------------->	strncpy((out)+1, (in), (len));	\
> 				(out)[(len)-1] = 0;	\
> 				strcat((out), "\""); \
> 				(in) = (out); }

You may not use quote character (") in character variable. The part I've
marked should be '\"' and then you should not get any warnings. 
 
-----------------------------------+-------------------------------------------
    EARN: teittinen at finuh          I "Studying is the only way to do nothing
Internet: teittinen at cc.helsinki.fi I  without anyone complaining about it."
-----------------------------------+-------------------------------------------
             Marko Teittinen, student of computer science
-------------------------------------------------------------------------------



More information about the Comp.lang.c mailing list