Re: Optimizing empty functions in C

"VBDis" <vbdis@aol.com>
14 Jun 2002 15:25:06 -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)
Re: Optimizing empty functions in C wasowski@data.pl (Andrzej Wasowski) (2002-06-20)
Re: Optimizing empty functions in C wasowski@data.pl (Andrzej Wasowski) (2002-06-20)
Re: Optimizing empty functions in C mlacey@microsoft.com (Mark Lacey \[MSFT\]) (2002-06-20)
[6 later articles]
| List of all articles for this month |

From: "VBDis" <vbdis@aol.com>
Newsgroups: comp.compilers
Date: 14 Jun 2002 15:25:06 -0400
Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com
References: 02-06-025
Keywords: optimize, C
Posted-Date: 14 Jun 2002 15:25:06 EDT

  "Andrzej Wasowski" <wasowski@data.pl> schreibt:


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


IMO the key is "inline". Inline functions are compiled to inline code
whenever possible, and then the compiler will produce no code for
empty procedure bodies. In special situations, when e.g. a debug build
is requested or when function pointers are involved, then the
procedures are not inlined.


In former times the C preprocessor was used to provide such
functionality, but the C++ inline procedures and templates are much
more powerful, with regards to e.g. type checking and polymorphism.


DoDi


Post a followup to this message

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