Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!unmvax!bbx!bbxsda!scott From: scott@bbxsda.UUCP (Scott Amspoker) Newsgroups: comp.lang.c Subject: Re: common bugs in C programs Message-ID: <532@bbxsda.UUCP> Date: 8 Jan 90 22:02:10 GMT References: <7140.25959377@urchin.fidonet.org> <430009@hpqtdla.HP.COM> Reply-To: scott@bbxsda.UUCP (Scott Amspoker) Organization: Basis International, Albuquerque, NM Lines: 21 In article <430009@hpqtdla.HP.COM> malkie@hpqtdla.HP.COM (Malcolm Rix) writes: > While developing code and reviewing the work of others >in the common firmware group we have been collecting a list of the most >frequent problems: >[list deleted] one of my favorites: i = (getchar()<<8) + getchar(); The evaluation order is not guaranteed. A similar thing can happen with function arguments. should be: i = getchar()<<8; i += getchar(); -- Scott Amspoker Basis International, Albuquerque, NM (505) 345-5232 unmvax.cs.unm.edu!bbx!bbxsda!scott