Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!csd4.milw.wisc.edu!bionet!ames!amdcad!sun!pitstop!sundc!seismo!uunet!kddlab!titcca!sragwa!wsgw!socslgw!diamond From: diamond@csl.sony.JUNET (Norman Diamond) Newsgroups: comp.lang.c Subject: Re: Strange cc warning Message-ID: <10033@diamond.csl.sony.JUNET> Date: 1 Feb 89 02:57:02 GMT References: <490@marob.MASA.COM> Organization: Sony Computer Science Laboratory Inc., Tokyo, Japan Lines: 30 In article <490@marob.MASA.COM>, daveh@marob.MASA.COM (Dave Hammond) writes: > ../include/dsipriv.h(88) : warning 74: > non standard extension used - 'macro formals in strings' > /* 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); } > Note that this is a warning, not an error. The program compiles fine > and the macro does as intended. If any kind soul can clue me as to the > problem in the above macro, I'd be for(;;) indebted. 1. One possible guess (slim chance) is the combination of all three: (a) In one of your invocations, you have a "string literal" for in; (b) Your compiler implements strncpy as a macro; and (c) Your compiler overzealously checks the wrong conditions for issuing that warning. 2. I am really curious about line 91. When you wrap an lvalue in parentheses, doesn't it become an rvalue? How can you assign to it? -- Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp@relay.cs.net) The above opinions are my own. | Why are programmers criticized for If they're also your opinions, | re-inventing the wheel, when car you're infringing my copyright. | manufacturers are praised for it?