delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/26/02:45:45

Date: Thu, 26 Nov 1998 09:45:52 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Michael Schuster <schuster AT eev DOT e-technik DOT uni-erlangen DOT de>
cc: djgpp AT delorie DOT com
Subject: Re: string class
In-Reply-To: <19981125.15040516@eev6.eev>
Message-ID: <Pine.SUN.3.91.981126094447.14160D-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Wed, 25 Nov 1998, Michael Schuster wrote:

> The solving was done by Jorge Ivan Meza Martinez who finally found 
> that you have to compile with gxx test.cc -O2  -lgpp 
> because the String constructor is declared as inline which is not 
> expanded before using optimization -O2 ( a bad thing I think)
> 
> Perhaps Eli/Dj could you explain this in the faq? 

It's already in the FAQ.  Here's an excerpt:

  8.10 Some functions still not found in C++ programs
  ===================================================

  **Q*: I put all the libraries in the above order, but the linker still can't
  find some C++ functions from `complex.h' and `iostream.h.'*
  [...]
  *A*:  Some C++ functions are declared `inline' and defined on header files.
  However, GCC won't inline them unless you compile with optimizations enabled,
  so it tries to find the compiled version of the functions in the library.
  Workaround: compile with `-O'.

There's also this entry in the Index:

  * GCC won't find inline functions without -O: Section 8.10.

Granted, the above doesn't mention the String class explicitly, but I
don't think it is reasonable to expect the FAQ to mention every
possible case of such problems.  After all, a FAQ is not a Knowledge
Base (even though the DJGPP FAQ sometimes looks like one ;-).

- Raw text -


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