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

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


I'm not a major Hatari contributor but I also think it makes sense to use the types from inttypes.h and avoid depending on SDL2 in parts of the code that don't need to know about SDL.

On Sat, 24 Sept 2022 at 16:40, Nicolas Pomarède <npomarede@xxxxxxxxxxxx> wrote:
Le 24/09/2022 à 17:33, Eero Tamminen a écrit :
> Hi,
>
> On 24.9.2022 14.53, Thomas Huth wrote:
>> The recent changes wrt FindSDL2.cmake made me aware again of the fact
>> that
>> almost all our source files depend on the SDL headers - which can be
>> cumbersome in situations like this (since you've got to add
>> target_link_library() to each and every internal sub-library of the
>> project). This dependencies exists mainly because we're including
>> <SDL_types.h> in our main.h to get the old-fashioned types like Uint16
>> etc.
>>
>> Now, in some parts of the Hatari sources, we already use the types from
>> stdint.h / inttypes.h instead, which also work without the SDL
>> headers, so
>> it's currently quite a mix of types that we have in the sources. I wonder
>> whether we should slowly try to move away from the SDL types and finally
>> include "inttypes.h" in main.h instead? That way, the Hatari sources
>> could
>> also be easier used in spots that should not directly link to the SDL
>> library (like the files in tests/debugger/ for example)...
>>
>> Opinions? Would it be OK to switch non-SDL related files to uint16_t
>> instead of Uint16 etc. ? Or is anybody really keen on keeping the SDL
>> types?
>
> I'm in favor of using standard types instead of SDL ones.
>
> (And that change does not need to be slow one, as one can do most of the
> transition with sed, and if it compiles, it's fine.)

It's ok for me too if we switch to inttypes.h and don't use SDL2 types
anymore (except maybe when calling SDL functions ?).

Nicolass




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