From owner-freebsd-hackers Sat Feb 22 15:44:42 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id PAA00758 for hackers-outgoing; Sat, 22 Feb 1997 15:44:42 -0800 (PST) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id PAA00691; Sat, 22 Feb 1997 15:43:58 -0800 (PST) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id KAA00728; Sun, 23 Feb 1997 10:07:43 +1030 (CST) From: Michael Smith Message-Id: <199702222337.KAA00728@genesis.atrad.adelaide.edu.au> Subject: Re: hmm In-Reply-To: from Alex Belits at "Feb 22, 97 12:35:09 pm" To: abelits@phobos.illtel.denver.co.us (Alex Belits) Date: Sun, 23 Feb 1997 10:07:42 +1030 (CST) Cc: terry@lambert.org, guido@gvr.win.tue.nl, dillon@best.net, gurney_j@resnet.uoregon.edu, top@sonic.cris.net, audit-bin@freebsd.org, FreeBSD-hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Alex Belits stands accused of saying: > On Sat, 22 Feb 1997, Terry Lambert wrote: > > > > with p="" > > > *p != '\0' && p[strlen(p) - 1] == '[' _still_ will read a byte p[-1]. > > > > What? > > > > IF p = "" > > THEN *p = '\0' > > > > by definition of ""... > > but p[strlen(p) - 1] will be p[-1] > Optimization done by compiler may skip it, but depending on that will be > rather dangerous. We just had this discussion, and as the erring party in the previous iteration, I find myself obliged to point out that the C language specification mandates that arguments to '&&' are evaluated left-to-right, and that evaluation stops as soon as a conclusive condition is met. Thus, if *p is 0, p[-1] will _not_ be referenced. > Alex -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[