Optimizing empty functions in C

"Andrzej Wasowski" <wasowski@data.pl>
13 Jun 2002 21:01:12 -0400

          From comp.compilers

Related articles
Optimizing empty functions in C wasowski@data.pl (Andrzej Wasowski) (2002-06-13)
Re: Optimizing empty functions in C snicol@apk.net (Scott Nicol) (2002-06-14)
Re: Optimizing empty functions in C joachim_d@gmx.de (Joachim Durchholz) (2002-06-14)
Re: Optimizing empty functions in C vbdis@aol.com (VBDis) (2002-06-14)
Re: Optimizing empty functions in C debray@CS.Arizona.EDU (Saumya K. Debray) (2002-06-14)
Re: Optimizing empty functions in C cdg@nullstone.com (Christopher Glaeser) (2002-06-17)
Re: Optimizing empty functions in C wasowski@data.pl (Andrzej Wasowski) (2002-06-20)
[10 later articles]
| List of all articles for this month |
From: "Andrzej Wasowski" <wasowski@data.pl>
Newsgroups: comp.compilers
Date: 13 Jun 2002 21:01:12 -0400
Organization: UNI-C
Keywords: C, optimize, question
Posted-Date: 13 Jun 2002 21:01:12 EDT

hello all C-compiler gurus,


I just wondered what is the tradition of C-compilers about redundeant
code. Will two identical functions generate the same code twice? A
special case of this problem is most interesting for me: if I put many
empty functions of the same time (let's say void f(void)) in my code -
will I get many empty functions generated, just one of them, or
perhaps none (because the compiler can eliminate the call alread)?


what if the function is potentially called via function pointer? (I
belive it is non-trivial to eliminate the call then).


Last but not the list: what would be normally faster to execute:


a call to an empty function or a check of integer flag (check if there
is any function to call), sthg like"


if non_empty_f then f(); /* if f is empty */


andrzej




--
String.concat[ "wasowski", "@", "data", ".", "pl"]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.