🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9324

Equality vs Assignment

#9324
From: kpk
Date: Wed, 17 Sep 1986 00:23
18 lines
1030 bytes
Who among us has not been bitten at least once by writing

if (x = 1) ...

when he/she meant

if (x == 1)

What I want to know is

Has anyone written a program to scan a C program and issue a warning message
for those lines where an assignment has occured in a conditional statement
(i.e. if, while, the third statement in a for loop)?

If anyone has written such a program, why not post it (or at least mail me a
copy)?

To any yacc and lex hacks: why not see if you can whip up such a program?
Technical Details
Message-ID: <2259@gitpyr.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!caip!princeton!allegra!ulysses!bellcore!whuxcc!lcuxlm!akgua!gatech!gitpyr!kpk

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!caip!princeton!allegra!ulysses!bellcore!whuxcc!lcuxlm!akgua!gatech!gitpyr!kpk
From: kpk@gitpyr.UUCP
Newsgroups: net.lang.c
Subject: Equality vs Assignment
Message-ID: <2259@gitpyr.UUCP>
Date: Tue, 16-Sep-86 20:23:52 EDT
Article-I.D.: gitpyr.2259
Posted: Tue Sep 16 20:23:52 1986
Date-Received: Fri, 19-Sep-86 21:16:36 EDT
Organization: Georgia Institute of Technology
Lines: 18
Keywords: Who has not been bitten