[tbm at cyrius.com: Bug#441533: GCC 4.3 related: missing #includes]
Steve M. Robbins
steve at sumost.ca
Tue Dec 11 18:10:18 CET 2007
On Tue, Dec 11, 2007 at 08:03:03AM +0100, Marc Glisse wrote:
> On Mon, 10 Dec 2007, Tim Van Holder wrote:
>>> A Debian user has reported a missing #include in gmp.h.
>>>> /usr/include/gmp.h:520: error: 'std::FILE' has not been declared
>>> +#include <iostream> /* for std::FILE */
>> std::FILE is the C++ way of referring to C's file - so I think the
>> correct include is <cstdio>, NOT <iostream>.
> Besides, I don't think there is a missing #include in gmp.h, the error lies
> elsewhere. The code with FILE in gmp.h is protected by a check that the
> stdio header was included. Now I believe the issue is that the glibc/gcc
> standard headers are c++-buggy in the sense that including stdio.h puts
> FILE only in the global namespace and not also in the std:: namespace as it
I'm never sure what header should declare what.
Where did you find such a list?
> Alternatively, the kde code that includes stdio.h before including
> gmp.h should include cstdio instead (or both just to be sure).
> Note that it is a documented feature of gmp that you need to include
> stdio.h/cstdio before gmp.h if you want the FILE related functions.
Well, the docs do mention stdio.h, but not cstdio.
> Now the reason for not including stdio by default for gmp is I think less
> relevant for C++ than for C, and it could make sense to always include it
> for C++ the way S. Robbins suggests.
That strikes me as a good change.
It would be less surprising to the programmer, as not everyone reads
the docs from cover to cover. If you look only at, say, the docs for
gmp_fprintf(), you won't see anything about #including stdio.h.
Incidentally: why not include stdio.h by default?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://gmplib.org/list-archives/gmp-bugs/attachments/20071211/bf192d6d/attachment.bin
More information about the gmp-bugs