C++ standard header inclusion artifact?
Andrew Haley
aph@redhat.com
Wed Jan 21 17:17:00 GMT 2009
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