The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem to send rtf inline body srik_ux UNIX for Dummies Questions & Answers 7 05-30-2008 12:30 PM
Array Printing Inline vakharia Mahesh Shell Programming and Scripting 2 05-21-2008 01:53 PM
command to find out total size of a specific file size (spread over the server) abhinov SUN Solaris 3 08-08-2007 07:48 AM
Inline Parameters-Urgent indira Shell Programming and Scripting 2 05-02-2007 05:02 PM
sed / awk - inplace or inline edit hemangjani Shell Programming and Scripting 6 02-22-2007 06:40 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-31-2005
vijaysabari vijaysabari is offline
Registered User
  
 

Join Date: Jun 2004
Posts: 13
Will exe file size decrease while using inline function

using namespace std;
void g();
class A {
public :
A() { g();g();g(); cout << "Constructor of A"<< endl ;}
};
inline void g(){ cout << "vijay" <<endl; }
int main() {
A a;
}

when i use inline i get size 303488 Aug 31 12:05 a.out*

when not using inline i get size 303572 Aug 31 12:05 a.out*
  #2 (permalink)  
Old 08-31-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,808
You cannot predict the size of an executable. Inlining often results in LARGER code blocks, not smaller. Note the word "often". Compilers do fun things when they optimize.

Compilers are not duty-bound to optimize just because you think they should.
If you use complex, tricky code compilers will often decide not to optimize.
HPUX C compilers do this - they back down optimization levels when presented with really convoluted code.

The only way I could imagine the size decreasing is because you invoke the inline function call in just one place in your code, or that some other optimization was turned off/on because of the inline function.
Closed Thread

Bookmarks

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

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




All times are GMT -4. The time now is 09:26 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0