Date: Sat, 22 Feb 1997 14:02:06 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: abelits@phobos.illtel.denver.co.us (Alex Belits) 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 Subject: Re: hmm Message-ID: <199702222102.OAA05142@phaeton.artisoft.com> In-Reply-To: <Pine.LNX.3.95.970222123316.30792B-100000@phobos.illtel.denver.co.us> from "Alex Belits" at Feb 22, 97 12:35:09 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> > > *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. && is a McCarthy AND... if the first expression is not true, then by definition of the C language use of the operator, the second expression will not be evaluated. The first expression is not true, so p[strlen(p) - 1] will never be evaluated. That's the whole point of having McCarthy operators, aside from lazy people not using !0 as boolean "true" and wanting their code to still work for fear of bitwise AND. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702222102.OAA05142>