Re: [hatari-devel] ikbd.c: missing #include <inttypes.h>

[ Thread Index | Date Index | More Archives ]

Am Sat, 2 May 2020 10:33:16 +0200
schrieb Nicolas Pomarède <npomarede@xxxxxxxxxxxx>:

> Le 02/05/2020 à 06:31, Thomas Huth a écrit :
> > Yes. It apparently wasn't necessary in the typical Linux build
> > environments (since this header was likely included by another
> > system header), and according to our CI, it even did not cause
> > trouble on FreeBSD and macOS to omit it, but it's certainly the
> > right way to include it here.  
> Hi
> BTW, we have several system includes duplicated in several .c files
> (for example inttypes.h, unistd.h, ctype.h, ...).
> Would it make sense to have a global.h file that would include these 
> systems includes and then just include global.h in our .c files ?

We've already got main.h which includes a couple of elementary header
files ... we maybe could move these to global.h instead, to separate
them from the other stuff in main.h which is more related to main.c...

But I have to say that I'm not a big fan of such headers that include
other headers... I've seen this in a couple of projects: You easily end
up including a loooot of stuff in each and every source code file this
way, resulting in longer compilation times and sometimes you even end
up in trouble with dependencies that you did not expect (e.g. remember
the "BOOL" type that was used in Hatari in the past? It clashed with a
type of the same name in one of the header files of Mac OS X, so
certain files failed to compile when one of the headers indirectly
included the header file with the "BOOL" definition...).

So if you really want to introduce such a global.h file, I'd recommend
to only include a very small set of headers from there (e.g. only the
ones from main.h and adding inttypes.h for example, with a big fat
warning comment not to include any other headers there without a real
good reason).


PS: Maybe we should also switch from SDL_types.h to the standard
definitions from stdint.h one day...?

Mail converted by MHonArc 2.6.19+