-- begin code for "C" language --
#ifdef AMD64
typedef unsigned int u32;
typedef unsigned long u64;
#elif defined(IA32)
typedef unsigned long u32;
typedef unsigned long long u64;
#else
#error Unsupported architecture
#endif
u32 stuff32;
u64 stuff64;
-- end code --
So, my question is what are the architecture specific "preprocessor
defines" in GCC ? I've already seen its manual.
Thanks in advance,
Ashish Shukla
Thanks for replying.
Maurizio Loreti wrote:
> "þÿ 6 B" <wah...@gmail.com> writes:
>
> > -- begin code for "C" language --
> > #ifdef AMD64
> > typedef unsigned int u32;
> > typedef unsigned long u64;
>
> You may want to read the current C Standard, and use integer types
> like uint32_t.
But I'm not using standard C libraries or headers here. And I'm
interested in knowing is there any way, in which GCC informs source
code about the target CPU architecture. The "AMD64" and "IA32"
preprocessor defines, above are fictious.
I'm expecting something similar to "__cplusplus" (which is defined by
compiler if it is a C++ compiler). So I want to know if CPU
architecture information is available in a similar manner.
>
> --
> Maurizio Loreti http://www.pd.infn.it/~loreti/mlo.html
> Dept. of Physics, Univ. of Padova, Italy ROT13: ybe...@cq.vasa.vg
Thanks,
Ashish Shukla
--
http://wahjava.wordpress.com/
> I'm expecting something similar to "__cplusplus" (which is defined by
> compiler if it is a C++ compiler). So I want to know if CPU
> architecture information is available in a similar manner.
Yes; you can obtain the list of preprocessor defined symbols asking
for them when processing an empty file --- e.g., with ther command
echo | gcc -E -dM -
Maurizio Loreti wrote:
>
> echo | gcc -E -dM -
>
Thanks it worked