GD_SIZE(3)

πŸ’– GD_SIZE(3) πŸ’–

ok so bestie, this is a page from the GETDATA manual β€” and today's main character is GD_SIZE. it's a tiny little macro with one job and honestly? she ate. ✨


✨ NAME ✨

GD_SIZE β€” report the size of a GetData data sample πŸŽ€


🌸 SYNOPSIS 🌸

#include <getdata.h>

int GD_SIZE(gd_type_t type);

like, that's it. one include, one macro, one argument. no notes. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the GD_SIZE() preprocessor macro returns the size in bytes of a single sample of data of the type you hand it via type. and type should be one of these iconic little symbols:

  • GD_NULL
  • GD_UINT8
  • GD_INT8
  • GD_UINT16
  • GD_INT16
  • GD_UINT32
  • GD_INT32
  • GD_FLOAT32
  • GD_FLOAT64
  • GD_COMPLEX64
  • GD_COMPLEX128
  • GD_STRING
  • GD_UNKNOWN

so here's the tea on what you get back:

  • pass GD_NULL or GD_UNKNOWN and you get zero. literally nothing. zero bytes. it's giving void. πŸ•³οΈ
  • pass GD_STRING and you get sizeof(const char*). yes bestie, the size of the pointer, not the string. she's a pointer girlie. πŸ’…
  • for all the other types, the value returned is just the bit-size encoded in the type symbol divided by eight. so like, GD_SIZE(GD_COMPLEX64) will return 8. math queen fr fr. πŸ‘‘
⚠️ no cap, no error checking happens on type. so if you pass literally anything that isn't one of the symbols listed above, the behaviour is unspecified. do not do that. i'm begging. πŸ™ˆ

and if you wanna know what all those symbols even mean, go read gd_getdata(3). iykyk. πŸ“–


🌈 HISTORY 🌈

the GD_SIZE() macro appeared in GetData-0.3.0 β€” a true vintage icon, she's been serving since day one. 🫢


⭐ SEE ALSO ⭐


and that's the whole page, bestie!! this was Version 0.10.0, dated 25 December 2016 β€” happy holidays from the GetData girlies, mwah πŸ’–πŸŽ€βœ¨πŸ¦‹πŸŒΈ