C++ standard header inclusion artifact?

Rodolfo Federico Gamarra rgamarra@gmail.com
Wed Jan 21 17:29:00 GMT 2009


Thanks Andrew.

So I understand that the fact that

#include <stdint.h>

isn't actually needed when <iostream> is included is some kind of bug;
as you point that the smooth compilation isn't right.

It seems that I should report this in Bugzilla, shouldn't I?

Thanks a lot again.

--
Rodolfo Federico Gamarra



On Wed, Jan 21, 2009 at 15:17, Andrew Haley <aph@redhat.com> wrote:
> Rodolfo Federico Gamarra wrote:
>> Hi!
>>
>> I'm wishing to use some exact width integer types with
>>
>> g++ (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
>>
>> I believe that uint32_t and stuff like that are not part of C++'s
>> 14882 standard, they are part of C's C99 standard (and defined in
>> stdint.h)
>>
>> This tiny program:
>> class A {
>>   public:
>>     static const uint32_t k = 256;
>> };
>> int main() { }
>>
>> Doesn't compile:
>>
>> uint$ g++ *.cc -o main -Wall -std=c++98
>> main.cc:3: error: 'uint32_t' does not name a type
>>
>> This seems right; however the inclusion of this line (at the beginning)
>>
>> #include <iostream>
>>
>> is enough to have it compiling smoothly with the same former command
>> (no console output).
>>
>> Is this right?
>
> No.
>
> #include <stdint.h>
>
> Andrew.
>
>
>
>
>
>
>
>
>
>
>  I'd have say (guessed) that that shouldn't happen.
>>
>> Or is this an implementation detail that shouldn't be relied on?
>>
>> Thanks a lot in advance for your help.
>>
>> --
>> Rodolfo Federico Gamarra
>
>



More information about the Gcc-help mailing list