Re: [hatari-devel] ikbd.c: missing #include <inttypes.h> |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] ikbd.c: missing #include <inttypes.h>
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Sat, 2 May 2020 11:49:15 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1588412957; bh=rTOaSKhgd8Qs67DumHOSZP1NYVWlSZvilyk5wDoqAJY=; h=Date:From:To:Subject:From; b=A9ugDjeQ1ljukbQDYmqn3BMMh+EA8yEVvCaVZuPhKJQnp81FP+Nk44kn6ijYyrx2G J2iBtj90Zq17RPQ2GoMEotEePKi8FnnhMTiMuUk7BxVz7uVWqRyLVYWYJZ1dCpXmEh ayRbPt2V47ge2npxo0/B32BX3bGB264WT0VxwmyyQMWDR3hKDmyOPHLfN1o0qvdgRZ lkySLTF61TUNcoCLk+05H935lcgyJLo49tU+4RJgNDNripCxH0MxBMcpE9AlLaGl52 vln/hKDrTOC12ZkhnyTWA17aSUBgYjnWuVILhfyVJWJ19vk6CSi4kQP5XVr+e8Uff/ d3XxqRw3E6BpA==
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).
Thomas
PS: Maybe we should also switch from SDL_types.h to the standard
definitions from stdint.h one day...?