From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: "Thomas Bushnell, BSG" Message-ID: <87k7sxh7un.fsf@becket.becket.net> Content-Type: text/plain; charset=us-ascii References: <3C7CFAFE.4996DA2A@research.bell-labs.com>, <87u1s2y1uu.fsf@becket.becket.net>, Subject: Re: [9fans] plan or side effect Date: Thu, 28 Feb 2002 16:57:05 +0000 Topicbox-Message-UUID: 5c36291c-eaca-11e9-9e20-41e7f4b1d025 Ralph Corderoy writes: > It doesn't have special knowledge of some functions behaviour then, > like AIX's xlc compiler? For example, #defines strlen(s) to > be __strlen(s) and the compiler knows that calls to __strlen can be > optimised in various ways because it knows more about strlen's > behaviour than can be expressed in . No, in general GCC does not have such knowledge. If it is able to inline the function, then of course it can do the optimization, but an inlined function isn't a function call at all, so that's really a different case. Also, GCC has some builtin functions; it knows the behavior of those. But not (in general) library functions. This is the kind of inter-function optimization that the MIPS compiler does quite generally, and GCC doesn't really attempt at all. (One reason, certainly, is that it's a little fragile, especially when the C library and GCC are developed separately.) Thomas