tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Avoiding #define uint8_t (and similar) in stdint.h



On Thu 18 Dec 2014 at 22:22:19 +0100, Martin Husemann wrote:
> On Thu, Dec 18, 2014 at 10:05:26PM +0100, Rhialto wrote:
> > Unfortunately, duplicate typedefs are not allowed, even if identical.
> > I suppose that's what the #ifdef dance is for, to avoid them at all
> > costs. Especially if including other header files may cause them to be
> > typedef'ed.
> 
> Hmm, is that a C++ism? gcc does not warn about it.

Hmm you must have other defaults than me:

$ cat typedef.c 
typedef int foo_t;
typedef int foo_t;
$ gcc typedef.c
typedef.c:2:13: error: redefinition of typedef 'foo_t'
typedef.c:1:13: note: previous declaration of 'foo_t' was here


$ uname -a
NetBSD murthe.falu.nl 6.1.5 NetBSD 6.1.5 (MURTHE6.1.5) #0: Sun Oct  5 01:15:04 CEST 2014  rhialto%vargaz.falu.nl@localhost:/usr/src/sys/arch/amd64/compile/MURTHE6.1.5 amd64
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64--netbsd
Configured with: /usr/src2/tools/gcc/../../external/gpl3/gcc/dist/configure --target=x86_64--netbsd --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20111202' --enable-__cxa_atexit --with-tune=nocona --with-mpc=/var/obj/mknative/amd64/usr/src2/destdir.amd64/usr --with-mpfr=/var/obj/mknative/amd64/usr/src2/destdir.amd64/usr --with-gmp=/var/obj/mknative/amd64/usr/src2/destdir.amd64/usr --enable-tls --disable-multilib --disable-symvers --disable-libstdcxx-pch --build=x86_64-unknown-netbsd5.99.56 --host=x86_64--netbsd
Thread model: posix
gcc version 4.5.3 (NetBSD nb2 20110806) 
$ 

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert  -- The Doctor: No, 'eureka' is Greek for
\X/ rhialto/at/xs4all.nl    -- 'this bath is too hot.'

Attachment: pgpcV7nycE7SE.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index