Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!nuchat!moray!urchin!p6.f506.n106.z1.fidonet.org!Bob.Stout From: Bob.Stout@p6.f506.n106.z1.fidonet.org (Bob Stout) Newsgroups: comp.lang.c Subject: 'Possibly Incorrect Assignment' warnings from Turbo-C Message-ID: <3881.25715D5A@urchin.fidonet.org> Date: 26 Nov 89 22:51:26 GMT Sender: ufgate@urchin.fidonet.org (newsout1.26) Organization: FidoNet node 1:106/506.6 - Fulcrum's Edge, Spring TX Lines: 19 In an article of <24 Nov 89 18:07:29 GMT>, (Dave Hammond) writes: >In porting a program from Unix to Dos, I get an error from Turbo-C >`Possibly incorrect assignment' with code similar to the following: > >char *p, *func(); > >if (p = func()) > do_something(); The warning (not an error) will go away if you use instead: if (0 != (p = func())) do_something(); The warning exists because it saw an assignment operator where it expected a logical comparison operator. Since typing `=' when you mean `==' is a fairly common mistake, it always warns you with the "Possibly incorrect assignement" message.