Ticket #1545 (closed defect: fixed)
gmp 4.2.2: add #include <cstdio> in gmp.h
| Reported by: | mabshoff | Owned by: | was |
|---|---|---|---|
| Priority: | major | Milestone: | sage-3.0 |
| Component: | packages: standard | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | Reviewers: | ||
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description (last modified by mabshoff) (diff)
Richard B. Kreckel suggested in http://gmplib.org/list-archives/gmp-bugs/2007-December/000892.html to add #include cstdio> to gmp.h:
Hi Torbjorn! There's this line in gmp.h. But std::FILE hasn't been defined and with a conforming C++ compiler it won't be unless <cstdio> has been included before <gmp.h>. Note that including <stdio.h> is not enough, as it doesn't define namespace std. So, defined(__cplusplus) and including <stdio.h> is not enough to guarantee that std::FILE is known to the compiler. Apparently, the intent is to avoid including stdio.h or cstdio. Why? I would suggest including it. Besides, these using declarations are considered bad practice in header files. It would be better defining GMP_FILE or similar to either expand to FILE or std::FILE and use that instead of FILE. Cheers -richy.
I can only second that and we should do it per default since I have been bitten by this issue numerous times during the gcc 4.3 port. This should be during while doing #542 "get gmp-4.2.2 into SAGE". It is also related to #490 "gcc 4.3: fix gmp.h problem with "using std::FILE""
Cheers,
Michael
Change History
Note: See
TracTickets for help on using
tickets.
