Skip to Content.
Sympa Menu

freetds - Re: [freetds] Strange assert

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Rusty Wright <rusty AT socrates.Berkeley.EDU>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] Strange assert
  • Date: Tue, 18 Mar 2003 11:41:03 -0800 (PST)

I thought of that too; a good compiler could optimize it down to just
the last assignment. I haven't looked at assembly output since my
days on the VAX11; I'm on a SPARCstation and its assembly output is
gibberish to me.

Old habits die hard with me; I prefer to write code so that it's
obvious what's going on; the for loop counts down, the if test stops
it when it hits non-space. Obvious code is easier to maintain when
you come back to it later on or when someone else looks at it.
Tricky, clever code is for kids trying to impress someone. ;)

> Why not remove 'i':
>
> for( ; len && dres.c[len-1] == ' '; len--);
>
> Rusty, you mentioned CPU cycles. Does any of this affect the compiler's
> assembly output? I haven't checked.




Archive powered by MHonArc 2.6.24.

Top of Page