CFanatic

Go Back   CFanatic > Programming > C Programming

Join CFanatic Forum Now

which is faster ?++ or + topic posted under C Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 09-05-2010, 02:20 AM
Junior Member
 
Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
priyanka.js28 is on a distinguished road
| More
which is faster ?++ or +

which one of the following will execute faster?
int p=2;
p++; OR p=p+1;OR p+=1;


and y??
is it p++ bcoz it is a single instruction??...nd the rest r multiple...
Reply With Quote
  #2  
Old 09-05-2010, 08:30 AM
Senior Member
 
Join Date: Sep 2010
Location: Kolkata, India
Posts: 307
Thanks: 0
Thanked 15 Times in 15 Posts
techforum4u is on a distinguished road
| More
Re: which is faster ?++ or +

yes, from microprocessor point of view short instructions are likely to execute faster but if the instructions is expanded to the actual form and then converted to assembly code then I think there will not be any diff in the execution...
Reply With Quote
Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does reuse variable make program faster or save some memories? cpthk C++ Programming 1 09-02-2010 09:33 PM
Which is Faster - CArray OR std::vector? ncode MFC Programming 0 06-28-2010 10:55 PM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 02:50 AM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board