Skip to content

How to handle deprecated sdl2 functionality? #34

Closed
@Free-Pascal-meets-SDL-Website

Description

This issue is about a problem I ran into recently and saw also in a pull request recently.

Simple example:
Lets say there are some defines which are translated.

const
  SDL_DEFINE1 = 0;
  SDL_DEFINE2 = 1;
  SDL_DEFINE3 = 2;

In a newer version of the header file one of the defines is missing. Let's say the second define is missing. So the inc-file would be updated to:

const
  SDL_DEFINE1 = 0;
  SDL_DEFINE3 = 2;

However, this raises (at least) two problems.

  1. The define is (obviously) missing if someone is using an older version of sdl2 instead of the particualrly one to which the inc-file got updated.
  2. The second concern is raised particularly because we are not always updating consistently to one particular version AND not all files at the same time: Let's say some files are not updated yet (very old version), some are updated (not the most recent version), some are updated to the latest version of sdl2. If now in the newest version some defines are deleted because they are gone, this may conflict with functions or expectations which are present in very old or older versions as they need or at least expect these defines/functions to be present.

The example above can be extended to structs/records where in newer version fields are missing or change their variable type.

Solution:
Actually, I don't know a simple solution yet. except to have some conditional compilation. Something like:

const
  SDL_DEFINE1 = 0;
  {$IFDEF DEPRECATED_IN_NEWER_SDL2} SDL_DEFINE2 = 1; {$ENDIF}
  SDL_DEFINE3 = 2;

What are better solutions or should this be adressed anyway?

Best regards
Matthias

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionDiscuss an idea/feature/PR/issue...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions