octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Major issues with g++ 6 and gnulib


From: John W. Eaton
Subject: Re: Major issues with g++ 6 and gnulib
Date: Sat, 20 Feb 2016 15:15:05 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.5.0

On 02/20/2016 10:34 AM, Orion Poplawski wrote:

Some comments from fedora-devel and a patch -
https://lists.fedoraproject.org/archives/list/address@hidden/message/UY3VX3W7XEXYTUKHG5BALU4ACUD7ZLGE/

I don't think we want to use something like "#include "libgnu/math.h" and I would really prefer to avoid including <math.h> directly in C++ files.

As I see it, the goal of gnulib is to allow us to write software that assumes a POSIX environment that works, and to have broken or missing functions replaced without having to do anything special. So we should be able to include standard C++ and POSIX headers unconditionally and expect the functions they provide to work.

I think gnulib meets this goal for C programs fairly well.

For C++ there are some problems.

The assumption that <cmath> will include a <math.h> in a way that would allow us to wrap it with the gnulib <math.h> file was always questionable. I think we went with that option because gnulib was (and is) primarily aimed at C language programs and making it work for C++ was a secondary goal. But it seemed to work for all platforms of interest and it was easier than any other option. But now if this assumption isn't valid we'll have to find some other solution.

With C++, many (but not all) of the gnulib replacement functions are in a separate namespace. I suppose we could add a using statement so that functions could be called without the namespace tag, but that's still not quite the same as being able to call them with the "std::" namespace prefix.

Because of the assumption that standard C++ headers like <cmath> include the corresponding C headers like <math.h>, we may end up with symbols that we don't need or want. For example, if you use gnulib and include <cmath> a signbit function will be defined outside of the std namespace. That's not what should happen if you just include <cmath>.

As much as possible, I'd like to use only C++ headers and std:: namespace tags. But I'd still like to get replacements for functions that are missing or broken.

Can we do something similar to what gnulib was attempting, but directly wrapping <cmath> instead of wrapping <math.h> and assuming that <cmath> would include our wrapper?

jwe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]