From owner-freebsd-hackers Sat Feb 22 13:45:47 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id NAA20999 for hackers-outgoing; Sat, 22 Feb 1997 13:45:47 -0800 (PST) Received: from nic.follonett.no (nic.follonett.no [194.198.43.10]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id NAA20955; Sat, 22 Feb 1997 13:45:12 -0800 (PST) Received: (from uucp@localhost) by nic.follonett.no (8.8.5/8.8.3) with UUCP id WAA26746; Sat, 22 Feb 1997 22:43:35 +0100 (MET) Received: from oo7 (oo7.dimaga.com [192.0.0.65]) by dimaga.com (8.8.5/8.7.2) with SMTP id WAA04324; Sat, 22 Feb 1997 22:45:03 +0100 (MET) Message-Id: <3.0.32.19970222224502.00ac1650@dimaga.com> X-Sender: eivind@dimaga.com X-Mailer: Windows Eudora Pro Version 3.0 (32) Date: Sat, 22 Feb 1997 22:45:03 +0100 To: Alex Belits From: Eivind Eklund Subject: Re: hmm Cc: audit-bin@FreeBSD.ORG, FreeBSD-hackers@FreeBSD.ORG Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk [Alex Belits] >>> with p="" >>> *p != '\0' && p[strlen(p) - 1] == '[' _still_ will read a byte p[-1]. [Terry Lambert] >> What? >> >> IF p = "" >> THEN *p = '\0' >> >> by definition of ""... [Alex Belits] >but p[strlen(p) - 1] will be p[-1] >Optimization done by compiler may skip it, but depending on that will be >rather dangerous. && is defined as short-circuiting. If *p == '\0' the evaluation of p[strlen(p) - 1] == '[' is guaranteed to be skipped. Re-read your book on C :) Eivind Eklund perhaps@yes.no http://maybe.yes.no/perhaps/ eivind@freebsd.org