al_get_allegro_version(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ al_get_allegro_version ✨

okay bestie, welcome to the Allegro reference manual page for al_get_allegro_version β€” yes the whole manual name is in the title up there, al_get_allegro_version(3alleg5), we're not hiding it πŸ’–. This one's short and sweet and it's giving "I just want to know what version I'm running" energy. Let's go πŸ¦‹


🌸 NAME 🌸

al_get_allegro_version β€” the Allegro 5 API function that tells you what version you've got, no cap πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro5/allegro.h>

uint32_t al_get_allegro_version(void)

look at her. no arguments, just vibes. she takes void and gives you back a uint32_t 🫢


πŸ’– DESCRIPTION πŸ’–

So basically, al_get_allegro_version returns the compiled version of the Allegro library β€” as in, the version you actually built against, not some runtime surprise β€” and it squishes the whole thing into one single integer like the little packing genius it is. The bits are grouped in chunks of 8, in this exact shape:

(major << 24) | (minor << 16) | (revision << 8) | release

four little 8-bit besties stacked in one uint32_t. iconic behaviour, honestly 🌈

Wanna crack it open? Here's the code, copy it exactly, no editing the recipe:

uint32_t version = al_get_allegro_version();
int major = version >> 24;
int minor = (version >> 16) & 255;
int revision = (version >> 8) & 255;
int release = version & 255;

and now the part you actually need to know for the vibe check πŸ“ β€” that release number? It's 0 for an unofficial version, and 1 or greater for an official release. So for example, "5.0.2[1]" would be the (first) official 5.0.2 release, while "5.0.2[0]" would be a compile of a version from the "5.0.2" branch before the official release dropped. so like… the pre-release era, the beta era, the "we're still cooking" era 🧚

lowkey important: 0 in that release slot means it's not an official release, so don't be out here treating it like one, bestie 😭

and that's the whole page, periodt πŸ‘‘

bye bestie, go forth and version-check πŸ’œ β€” this was the Allegro reference manual, al_get_allegro_version(3alleg5), signing off πŸŽ€

πŸ“¦ where this page comes from