Closed cyrilbouvier closed 5 years ago
Agreed: there should not be any assumption that givaro/givpoly1.h
is included before. There are such omission in many places, but we should fix them by adding the proper missing include
as what you're doing in dense-polynomial.h
The file
linbox/polynomial/dense-polynomial.h
cannot be included as is, the filegivaro/givpoly1.h
needs to be included before. For example, this codefails to compile (with thousands of lines of error from gcc, so nothing helpful).
But this one
compiles without errors.
The issue is that as a user that want to use the class DensePolynomial, it is easy to find that it is necessary to include
linbox/polynomial/dense-polynomial.h
but it can be quite complicated to find the other include statement(s) that could be necessary.In this case, this is easy to fix: adding
#include <givaro/givpoly1.h>
at the top oflinbox/polynomial/dense-polynomial.h
(PR is on its way), but i wanted to post this issue as there may be a more general problem of headers implicitly requiring others headers to be included before themselves.These implicit requirements can be a important complication for the users of the library:
linbox.h
file that include everything the user could need (in this particuliar case, includinglinbox/config.h
and/orlinbox/linbox-config.h
does not fix the problem).Moreover, the guidelines from the C standard states that