When to use strfwd.h

Pavel Sanda sanda at lyx.org
Tue Oct 1 16:18:18 UTC 2024


On Tue, Oct 01, 2024 at 01:02:29PM +0200, Jean-Marc Lasgouttes wrote:
> Le 01/10/2024 ?? 12:23, Pavel Sanda a écrit :
> > On Tue, Oct 01, 2024 at 11:12:00AM +0200, Jean-Marc Lasgouttes wrote:
> > > Basically, for gcc >=5 and libc++, we include <string>. Unless there is
> > > something I do not understand, the header is not really useful IMO.
> > 
> > Are you sure about this? I checked before sending my email and while
> > empty file with #include <string> produces 22k preprocesed lines,
> > #include "strfwd.h" on my debian stable produce ~400 lines
> > of preprocessed code including homebrewed
> > template<typename Char, typename Traits, typename Alloc> class basic_string;
> > typedef basic_string<char, char_traits<char>, allocator<char> > string;
> 
> I am not sure, I tried to read the code, but I might have been lost in
> ifdefs. How did you check your preprocessed code? Did you include <config.h>
> ?

No :) The config.h makes the difference.

> Have a look at Box.{cpp,h}, the simplest user. It uses "strfwd.h" only for
> <ostream>.
> 
> Now have a look in your build directory at
> src/.deps/Box.Po
> 
> You should see that <string> is loaded for no reason.

Right.

...
> It might be though that it makes a difference with cygwin or msvc.

I could produce patch which ditches strfwd and let Enrico/Eugene test it?

>From what I see it might do more harm than good in linux nowadys...

Pavel


More information about the lyx-devel mailing list