Re: [hatari-devel] Switching from SDL_types.h to inttypes.h ?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On 28.9.2022 23.04, Nicolas Pomarède wrote:
Le 28/09/2022 à 20:00, Troed Sångberg a écrit :
I would be in favor of keeping them in those cases. When SDL gets switched out in the future (or in a fork) you'd want to make sure you revisit all affected code.

I would keep them too, who knows if later some compiler might not
> complain if type is uint8_t instead of Uint8 for example in some SDL
> functions prototypes.

C language has integer promotion as basic feature. That's not going to change. I do not see any way to get compiler to check for these naming mismatches, especially when the underlying types are *identical*.

Besides, C compiler does not provide warnings even if you use e.g. uint8_t variable to provide SDL function Sint32 argument value.

If there were pointers to the types, that might matter, but as far as I can see, SDL functions take pointers only to SDL's own struct types, not to integers.


And it makes the code more explicit about the fact that it's related to SDL in some ways.

Where you would draw the line? And considering automatic integer promotion, how you could check for that?


	- Eero



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/