C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-24-2009, 06:35 AM   #1
Registered User
 
Join Date: Feb 2008
Posts: 107
About output size

Hi,

I use lots of functions to debug and for intermediate steps. When compiling, if I don't call a function, is it generated inside the output executable?
Kempelen is offline   Reply With Quote
Old 11-24-2009, 07:43 AM   #2
Woof, woof!
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Australia
Posts: 3,422
Quote:
Originally Posted by Kempelen View Post
Hi,

I use lots of functions to debug and for intermediate steps. When compiling, if I don't call a function, is it generated inside the output executable?
It may be, that would depend on the compiler and scope of the function. More than likely it would be based on the optimisation level and whether or not the function is exported. For example static functions would probably not given an optimisation level to adhere to.

Your compiler documentation should be able to tell you, either than or run a few tests (examine generated assembly code for example).

If you use them for debug, then the common practice is to wrap them as macros that evaluate to nothing when called.


For example:
Code:
#ifdef DEBUG
#   define debug_myfunction(x) do { myfunction(x); } while(0)
#else
#   define debug_myfunction(x) do { } while(0)
#endif
__________________
My homepage | premake | vim

Last edited by zacs7; 11-24-2009 at 07:47 AM.
zacs7 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me please. yann C Programming 15 09-29-2009 09:04 PM
Stack around the variable 'Output' was corrupted jacksb68 C Programming 5 09-08-2009 08:55 AM
[Tutorial] Implementing the Advanced Encryption Standard KONI C Programming 16 11-23-2007 01:48 PM
Error with a vector Tropicalia C++ Programming 20 09-28-2006 07:45 PM
File Size and File Size on Disk DavidP A Brief History of Cprogramming.com 4 12-15-2001 08:03 PM


All times are GMT -6. The time now is 02:42 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22