osdir.com
mailing list archive

Subject: Re: using std::FILE - msg#00023

List: lib.gmp.bugs

Date: Prev Next Index Thread: Prev Index
Richard B. Kreckel wrote:
> Hi!
>
> Marc Glisse wrote:
>> On Sun, 16 Dec 2007, Richard B. Kreckel wrote:
>>> Note that
>>> including <stdio.h> is not enough, as it doesn't define namespace std.
>>
>> That is a bug, the current standard says it should (that may change in
>> the next standard, but hasn't yet).
>
> Are you sure? So, this is a bug in GCC?

Yes. Clause D.5.2 of the C++ standard. (Annex D is normative.)

| Each C header, whose name has the form name.h, behaves as if each
name placed in the Standard library
| namespace by the corresponding cname header is also placed within
the namespace scope of the name-
| space std and is followed by an explicit using-declaration (7.3.3)

--
SciFace Software GmbH & Co. KG
Technologiepark 11 Tel: ++49 (0)5251 1843000
D-33100 Paderborn Fax: ++49 (0)5251 1843010
Deutschland Web: www.sciface.com
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRA 2080
Ust.-ID Nr.: DE 187992139
Persönlich haftende Gesellschaft:
SciFace Software Verwaltungsgesellschaft mbH
Registergericht Paderborn HRB 2924
Geschäftsführer: Dr. Oliver Kluge


Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

Re: using std::FILE

On Mon, 17 Dec 2007, Richard B. Kreckel wrote: > This is rejected by all versions of g++ I have access to, from gcc 3.3 > to gcc 3.4 prereleases. Try again with sun studio compilers on solaris. > Can you, please, point out the relevant section in the standard and, if > necessary, file a bug report for GCC? I already pointed the relevant section of the standard on this list last week... paragraph D.5.2 "Every C header, each of which has a name of the form name.h, behaves as if each name placed in the Standard library namespace by the corresponding cname header is also placed within the namespace scope of the namespace std and is followed by an explicit using-declaration (7.3.3)." The related gcc bugs are easy to find (standard function declarations linking into global namespace 6257, __cplusplus still not defined as 199711L 1773, etc) and are currently blocked. There is a defect report for the c++ standard that asks to make the current gcc behavior legal, claiming that doing otherwise requires cooperation from libc which is too hard (although solaris does it quite properly): http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#456 apparently they have decided to make what gcc does legal in the future revision of the standard and specify: stdio.h declares FILE, cstdio declares std::FILE, and each one is allowed but not required to also declare it in the other namespace. This list is not the best place to discuss this though. -- Marc Glisse

Previous Message by Thread: click to view message preview

Re: using std::FILE

Richard B. Kreckel wrote: > right. And if the next developer walks up and observes that <gmp.h> and > <stdio.h> do not commute (as any sane header files should), you can help Actually, this is the core of the problem, in my opinion. Leaving aside C++, g++'s deviations from the standard etc., the effect of #include <stdio.h> #include <gmp.h> and #include <gmp.h> #include <stdio.h> is different from one another, and both are legal. Personally, I regard that as a design bug, a problem waiting to bite the next unsuspecting developer. (Also note that the problem may be even worse: In the situation #include "foo.h" // ... #include <gmp.h> // ... #include <stdio.h> a change in some very remote place, foo.h or one of the files included there, can break the code.) I'd strongly suggest moving the relevant parts into a separate header instead of relying on some other header defining one of fourteen(!) include guards, internal macros etc. encountered so far. Just my â0.02. -- SciFace Software GmbH & Co. KG Technologiepark 11 Tel: ++49 (0)5251 1843000 D-33100 Paderborn Fax: ++49 (0)5251 1843010 Deutschland Web: www.sciface.com Sitz der Gesellschaft: Paderborn Registergericht Paderborn HRA 2080 Ust.-ID Nr.: DE 187992139 PersÃnlich haftende Gesellschaft: SciFace Software Verwaltungsgesellschaft mbH Registergericht Paderborn HRB 2924 GeschÃftsfÃhrer: Dr. Oliver Kluge _______________________________________________ gmp-bugs mailing list gmp-bugs@xxxxxxxx http://swox.com/mailman/listinfo/gmp-bugs

Next Message by Thread: click to view message preview

Re: using std::FILE

Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by