__FPTRCAST(3)

๐Ÿ“ฆ version 11.0, in nixpkgs unstable

๐Ÿ’– __FPTRCAST(3) โ€” Library Functions Manual ๐Ÿ’–

okay so bestie, welcome to __FPTRCAST(3) from the Library Functions Manual โ€” this is the little macro that does a function pointer cast and gives certain compiler warnings a polite little โ€œnot todayโ€ ๐Ÿ’….

NAME

__FPTRCAST โ€” function pointer cast, no cap.

SYNOPSIS

#include <sys/cdefs.h>

ftype
__FPTRCAST(ftype, fname);

DESCRIPTION

okay so the __FPTRCAST() macro can be used to silence warnings produced by certain compilers when converting from one function pointer type to another. The ftype argument is the function pointer type to which to cast the function pointer in fname. โœจ

This cast should be used sparingly, bestie โ€” like, itโ€™s not a cute little accessory, itโ€™s a โ€œwe have a reasonโ€ kind of move. Itโ€™s typically used in the following situations:

  • We know that the function prototypes donโ€™t match at all, but we donโ€™t care because we point it to a function that does not take arguments and returns an error. ๐Ÿ’€
  • We only care about the first few arguments and we donโ€™t care about the rest. ๐Ÿ™ˆ
  • We donโ€™t care about the return value, we ignore it anyway. โœจ

IMPLEMENTATION NOTES

Under the hood, this macro is implemented by using an intermediate void * cast. Thatโ€™s the whole note, icon. ๐ŸŽ€

SEE ALSO

CAVEATS

๐Ÿšจ Use of this macro can hide valid errors, and its usage is not recommended unless there is a well-thought reason for a cast.

As a general guideline, donโ€™t use this macro inside other macros because it will hide cases where the user of the original macro accidentally used an incorrect function pointer. ๐Ÿ˜ญ

Use of this macro is non-portable; this is part of the implementation namespace and should only be used in NetBSD code. ๐Ÿซถ


๐Ÿ’– okay thatโ€™s the page, bestie! This one is from Debian, dated October 17, 2013, and itโ€™s literally __FPTRCAST(3) โ€” bye, go cast responsibly ๐Ÿ’…

๐Ÿ“ฆ where this page comes from