Re: Comments on File of the Week: debug.c On 5/16/07, jerry gay  wrote:
>
> On 5/16/07, Andrew Spieherty  wrote:
> > On Wed, 16 May 2007, Klaas-Jan Stol wrote:
> >
> > > hi,
> > > I've been studying the code in the fotw: debug.c and below are my
> comments,
> > > if they're of any interest. Feel free to neglect, I'm kinda picky.
> > >
> > > 1.
> > >    while (*command && (isalnum((int) *command) || *command == ',' ||
> > >        *command == ']'))
> > >
> > > I'm not 100% sure, but:
> > > I've always been taught that this should not be written like this. The
> issue
> > > here is that you ASSUME that the compiler does expression
> short-cutting
> > > during evaluating the && expression. Suppose a c compiler does not
> implement
> > > this,
> >
> > Short-circuiting like this is guaranteed in C, dating all the way back
> to
> > K&R 1.  If the compiler doesn't implement it, it's badly broken.
> >
> it's bitwise AND where order isn't guaranteed--i'm pretty sure that's
> the point of confusion.
> ~jerry
>

Actually, I was taught when learning Java, and assumed (yes, I know....) it
might have been the case for C. Anyway, please don't forget the other
comments :-) This one was trivial ;-)

kj
