apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich Drepper <drep...@redhat.com>
Subject Re: Is --enable-utf8 working everywhere?
Date Wed, 17 Jul 2002 21:33:17 GMT
On Wed, 2002-07-17 at 09:35, Alan Shutko wrote:

> Could you explain what the impact of this is?  Is the concern that
> we'll have a different result between calls to the hidden function
> call, or that it's somewhat wasteful to call it multiple times, or
> something else?

Compile this code:

extern int *foo (void);
bar (void)
  return *foo () ? *foo () : 1;

This is what effectively corresponds to

  return errno ? errno : 1;

You will always end up with two calls to 'foo' since the compiler is not
allowed to eliminate them.  It has no means to determine that 'foo' has
no side effects and a constant return value.

With gcc the story is different since we can declare 'foo' as

  extern int *foo (void) __attribute__ ((const));

This is why you see only one function can.  But this doesn't work with a
compiler which only implements ISO C or which has no support in the
system's headers.

---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

View raw message