[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Is --enable-utf8 working everywhere?

From: Ulrich Drepper <drepper_at_redhat.com>
Date: 2002-07-17 23:33:17 CEST

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);
int
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   `------------------------

Received on Wed Jul 17 23:35:20 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.