[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [RFC] Simplify use of apr_hash_this()

From: Steve Sisak <sgs_at_codewell.com>
Date: Tue, 30 Jun 2009 22:46:49 -0400

At 12:45 AM +0100 7/1/09, Julian Foad wrote:
>I got confused by the fact that we use temp vars in many instances but
>explicit casts in other instances (see below). This made me think the
>two approaches were equally correct. I think I understand now that:
>
> - the temp vars are essential for a strictly correct solution;
> - we already use temp vars and get a strictly correct solution in the
>majority of cases;
> - I was proposing (in my "simple" solution) doing away with the temp
>vars everywhere;
> - so that "solution" would have brought every instance down to the
>lowest common denominator of correctness.

Incidentally, it's worth adding that, not only are the temp vars
necessary for correctness, but they're unlikely to harm performance
and may actually improve it because they make life easier for the
optimizer.

When you take the address of a variable (in C), it can no longer be
placed in a register -- unless the compiler figures out you meant and
generates a temporary variable for you.

With modern compilers, it's generally better to be explicit in your
code so the compiler has a better chance optimize it correctly.

Cheers,

-Steve

P.S. You might want to see what warnings the LLVM static analyzer
generates for this code.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2366912
Received on 2009-07-01 04:47:18 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.