C/C++
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives FAQs C/C++

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old July 29th, 2008, 09:00 AM
Chris Dollin
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Which is faster?

lak wrote:

Which is faster? Post Increment or assignment? Why?
I was not able to get any things.

/Usually/ -- I very carefully am not saying /always/ -- the
timing difference between using an auto-increment/decrement,
pre or post, vs an assignment like `spoo += 1`, is not
detectable in a run of an application.

This is because compilers are pretty smart and (although they
may need a little encouragement) will compile the various
different ways of saying "increment spoo" into the same
code, if that's legal. And I/ isn't cheap.

And the Standard doesn't say /anything/ about what the relative
costs are.

So, if it matters -- I say, /if/ it matters -- the faster thing
to use, if there is one, has to be determined by experiment,
and you have to realise that which the faster one is can change
as soon as you change machines, compilers, compiler options,
memory size, air conditioning, or the colour of your tie.

, which is to say, usually, pick whichever most
clearly expresses your intent to your audience.

--
'It changed the future and it changed us.' /Babylon 5/

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN


Reply With Quote
Reply

Viewing: Web Development Archives FAQs C/C++ > Which is faster?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek