www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/14/06:11:19

Date: Sun, 14 Feb 1999 13:08:25 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Paul Derbyshire <pderbysh AT usa DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Code gen question
In-Reply-To: <3.0.6.32.19990212180551.00841100@pop.netaddress.com>
Message-ID: <Pine.SUN.3.91.990214130759.15332E-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Fri, 12 Feb 1999, Paul Derbyshire wrote:

> If so, this leads me to ask: under what circumstances will the compiler be
> smart enough to detect that an inline function passed an argument of a
> builtin type doesn't modify it and avoid making an unnecessary copy?

From the GCC docs, it seems that declaring the function with
__attribute__((const)) will tell the compiler what you want, so you
won't need to rely on the optimizer being smart enough.  I didn't
actually try to see what that does in the special case you are
describing.  It's probably easy enough to use -S and look at the
assembly code it generates.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019