QB_ATOMIC_INT_ADD(3)

πŸ’– qb_atomic_int_add β€” bestie edition πŸ’–

okay so real quick, this is qb_atomic_int_add(3) from the libqb Programmer's Manual, section 3, and honestly? it's giving "tiny function, big responsibilities." let's get into it 🫢


✨ NAME ✨

qb_atomic_int_add β€” atomically adds val to the integer pointed to by atomic.

like, atomically atomically. no cap. 🧚


✨ SYNOPSIS ✨

#include <qb/qbatomic.h>

void qb_atomic_int_add(
    volatile int32_t QB_GNUC_MAY_ALIAS   *atomic,  /* a pointer to an integer */
    int32_t                               val      /* the value to add to *atomic */
);

bestie look at that signature. two args. no return value. it just does the thing. main character energy fr fr πŸ‘‘


✨ PARAMS ✨

  • atomic β€” a pointer to an integer. that's the lil guy getting the addition done to it πŸ’…
  • val β€” the value to add to *atomic. yes it goes into the pointer target, not the pointer itself. iykyk 😭

✨ DESCRIPTION ✨

so it adds val to the integer that atomic points at, and it does it atomically β€” which means nobody can sneak in halfway and catch it mid-addition. no half-finished math, no cursed in-between state. gorgeous. flawless. iconic. 🌸

also it acts as a memory barrier 🧱✨

that's the whole description. short king behavior but like, in a good way.


✨ SEE ALSO ✨

the whole friend group 🫢 go read these too:


Copyright (C) 2003 Sebastian Wilhelmi


and that's the whole page, bestie!! πŸŽ€ it's LIBQB, it's dated 2025-09-16, and it will forever be known as QB_ATOMIC_INT_ADD(3). mwah. go add some integers. atomically. πŸ’…πŸ’–

πŸ“¦ where this page comes from