Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Uncle Steve Newsgroups: comp.lang.c Subject: Re: Malloc Query Date: Mon, 23 May 2011 18:05:40 -0400 Organization: Friends of the Galactic Collective Lines: 60 Message-ID: <52abe5c90929121-7f162@gmail.com> References: <708913a057f3f9c-34aa7@gmail.com> <0.47b2d301a43a01009630.20110522231836BST.87fwo6nzur.fsf@bsb.me.uk> <21ceccb2e03a4dc-edfd3@gmail.com> <93tk6hFt2pU3@mid.individual.net> <93ugcsFt2pU6@mid.individual.net> <2cc0f0e084f264b-656fa@gmail.com> <93vrieFt2pU7@mid.individual.net> <9401d5Ft2pU8@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="job9yP/rmK/fxQbJrcqEcA"; logging-data="10649"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+P3iNOwVFu7jdP0uXES1jP" User-Agent: nn 6.7.3 Content-Length: 2239 Cancel-Lock: sha1:CgfmEjWf6wYtquWVhT4sQcExMzs= Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:4610 On Tue, May 24, 2011 at 09:20:37AM +1200, Ian Collins wrote: > On 05/24/11 08:24 AM, Uncle Steve wrote: > >On Tue, May 24, 2011 at 07:41:02AM +1200, Ian Collins wrote: > >>On 05/24/11 06:20 AM, Uncle Steve wrote: > >>>On Mon, May 23, 2011 at 07:24:11PM +1200, Ian Collins wrote: > >>>>On 05/23/11 05:57 PM, Uncle Steve wrote: > >>> > >>>>>For mu y purposes, it is > >>>>>sometimes nice to write a macro which uses conditionals to select a > >>>>>particular code path through the macro. If the conditional can be > >>>>>resolved at compile-time, the dead code branches in the macro are > >>>>>pruned, saving space. A similarly structured function call won't be > >>>>>optimized in this fashion unless (maybe) it is inlined. > >>>> > >>>>Why not? Whether the function is called or in line, the conditional > >>>>compiles are still there. > >>> > >>>A function is only inlined if it is defined in the same source file. > >> > >>Macros also have to be defined in the same compilation unit. > >> > >>>If you define a function in an external source file, it cannot be > >>>inlined anywhere else unless the function is also defined in an > >>>included header file. Doesn't everyone know this? > >> > >>I'm sure they do, what's your point? > > > >That function inlining, far from being the unfettered panacea some > >make it out to be, has inherent limitations owing to the way C > >compilers are designed to take their input. > > Which it shares with macros, so again, what is your point? > > The single compilation unit limitation will eventually be a thing of the > past as cross module optimisation become more common. For example > see http://gcc.gnu.org/wiki/LightweightIpo Filed under "what will they think of next". > >If your software is > >written as one monolithic source file, this may not be much of an > >issue, but I doubt that is the case for any non-trivial program. > > > >Given that reality, function-like macros can be included to inline > >code where it will do the most good. > > So can functions, so again, what is your point? To annoy with impertinent questions? Regards, Uncle Steve -- Should a professional politician be charged with molestation if he kisses babies while attending political rallies?