Strange cc warning

Jeffrey E. F. Friedl jeff at unh.UUCP
Wed Feb 1 16:21:55 AEST 1989


In article <490 at marob.MASA.COM>, daveh at marob.MASA.COM (Dave Hammond) writes:
about this strict warning from his compiler:
> ../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) = '"';	\
> Line 88 ------------------->  strncpy((out)+1, (in), (len));	\
> 				(out)[(len)-1] = 0;	\
> 				strcat((out), "\""); \
> 				(in) = (out); }
> 
> [it works fine, but why the warning?]

Looks to me as if your preprocessor is not very smart about quotes.
Perhaps it thinks that the double quote in line 87 is the beginning
of a string (which it would then match with quote #1 in line 90).

It thinks it's the same situation as if you had something like
    #define parenthesize_string_literal(WORD)	"(WORD)"
or some such thing.

Gee, when a preprocessor doesn't know the difference between " and '"'...  

Since you asked about the warning, I won't offer my comments about the
macro itself, although I'd love to.... [(-:].

	*jeff*

------------------------------------------------------------------------------
Jeffrey Eric Francis Friedl                             Box 2173 Babcock House
..!{uunet,decvax}!unh!jeff                          Durham New Hampshire 03824

So, Steve, how's that '89 Mustang GT Convertible doin'?



More information about the Comp.lang.c mailing list