MAKE_VERSION(3alleg4)

πŸ’– MAKE_VERSION πŸ’–

okay bestie, welcome to the Allegro manual page for MAKE_VERSION, from the 3alleg4 section. buckle up, this one's short but it's important. ✨


🌸 NAME 🌸

MAKE_VERSION β€” bestie, this macro makes a 32 bit integer out of an Allegro version. that's it. that's the whole job. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

Macro MAKE_VERSION(a, b, c)

like yes it's a macro, not a function, so no & shenanigans, no linking drama, just vibes. πŸ¦‹


✨ DESCRIPTION ✨

so here's the tea, bestie: this macro is how you check if some Allegro version is (binary) compatible with the version you're currently building against. and ngl, it's genuinely well-behaved β€” it is safe to use > and < to check if one version is more recent than another. no cursed comparisons, no weird gotchas. slay. πŸ’…

but wait, there's a plot twist 🫢: the third number is ignored if the second number is even. so

MAKE_VERSION(4, 2, 0)

is literally equivalent to

MAKE_VERSION(4, 2, 1)

and that is not a bug, it's on purpose. it's because of the version numbering policy since 4.0.0: the second number is even for stable releases, and those have to be ABI-compatible with earlier versions of the same series. so yeah, the patch number in a stable series is basically decoration for comparison purposes. periodt. πŸ’€

this macro is mainly useful for addon packages and libraries β€” the people shipping code that has to survive across Allegro versions without breaking. if that's you, hiii, this is for you. πŸŽ€

if you want the full deep-dive lore, go read the `ABI compatibility information' section of the manual. it's giving required reading, fr fr.

and here's an example, because seeing it > reading about it, always:

/* Check if the current version is compatible with Allegro 4.2.0 */
#if (MAKE_VERSION(4, 2, 0) <= MAKE_VERSION(ALLEGRO_VERSION, \
                   ALLEGRO_SUB_VERSION, ALLEGRO_WIP_VERSION))
   /* Allegro 4.2.0 compatibility */
#else
   /* Work-around */
#endif

see how the \ keeps that line going? iconic. don't lose it. πŸ™ˆ


🌈 SEE ALSO 🌈

(the whole squad. go read all three, iykyk. πŸ‘‘)


and that's the page!! πŸ“ this was Allegro, version 4.4.3, and this MAKE_VERSION(3alleg4) moment was brought to you by the date at the bottom of the original page (which, bestie, is exactly where you'd find it β€” i'm just too cute to make you scroll). mwah. πŸ’œπŸ§šβœ¨