I was looking for a small image processing library (as opposed to libMagickWand) and came across libvips [1]. I found it absolutely bizarre that the public API in a C library was full of variadic functions to support optional arguments. The last argument to most function calls is required to be NULL to denote the end of the argument list, e.g., https://libvips.github.io/libvips/API/current/using-from-c.h... (vips_image_new_from_file, vips_invert, etc.).[1]: https://libvips.github.io/libvips/
zlynx|6 years ago
If your system defines NULL as 0, which is legal in C++, then NULL in the vararg list only pushes an int-sized (4 bytes) zero, and the vararg reader pulls a pointer-sized (8 bytes) value, which may or may NOT equal zero because of the 4 extra bytes...
Avery3R|6 years ago
liuliu|6 years ago