inst182@tuvie (Inst.f.Techn.Informatik) (12/28/89)
As far as I can remember the semantics of an inline function is supposed to be
*EXACTLY* the same as if it were not declaread as inline. This, however, seems
not to be the case in most C++ 1.2 implementations. I only tried the following
program on an Apollo using Domain C++ and an Ultrix Vax with designer C++,
but it should reproduce on most other C++ 1.2 compilers (those based on the
AT&T version) as well:
---------------------------------------------------------------------------
#include <stdio.h>
struct loop { struct loop *next; };
struct loop loopback = { &loopback } ;
/* also try this without inline: */
inline overkill ( struct loop * x)
{
printf("%ul\n",x); /* this should print the same */
x->next = NULL;
printf("%ul\n",x); /* as this, ????? :-) */
}
main(){
overkill(loopback.next);
}
---------------------------------------------------------------------------
Michael K. Gschwind ...!uunet!mcvax!tuvie!vlsivie!gschwind
--
| _ | Peter J. Holzer | Think of it |
| |_|_) | Technische Universitaet Wien | as evolution |
| | | | hp@honey.tuwien.ac.at | in action! |
| __/ | ...!uunet!mcsun!tuvie!asupa!honey!hp | Tony Rand |kurtl@fai.UUCP (Kurt Luoto) (01/06/90)
In article <1046@tuvie> inst182@tuvie (Inst.f.Techn.Informatik) writes: >As far as I can remember the semantics of an inline function is supposed to be >*EXACTLY* the same as if it were not declaread as inline. This, however, seems >not to be the case in most C++ 1.2 implementations. [ ... ] > Michael K. Gschwind ...!uunet!mcvax!tuvie!vlsivie!gschwind >-- >| _ | Peter J. Holzer | Think of it | >| |_|_) | Technische Universitaet Wien | as evolution | >| | | | hp@honey.tuwien.ac.at | in action! | >| __/ | ...!uunet!mcsun!tuvie!asupa!honey!hp | Tony Rand | When I first learned C++ using cfront 1.2, I noticed that in some cases inline functions were often expanded in macro-fashion, sometimes with incorrect results. Some of these bugs are still present in cfront 2.0. We have a version of cfront 2.0 from HCR that comes with some AT&T release notes as well as HCR's own notes. The bug list in AT&T's notes ("Known Problems") doesn't mention this class of bugs, but the HCR notes do: 6. Known limitations [...] 3. Inline function: Bad code may be generated. The problem seems to be in testing if the arguments to the function need to be assigned to temporaries (Test: s4.C). I don't know the date of the AT&T notes, but HCR's is July 1989. Is there a more recent (and more complete) bug list? Any idea of when these bugs will be fixed? Just wondering ... -- ---------------- Kurt W. Luoto kurtl@fai.com or ...!sun!fai!kurtl