name mode size
libexec 040000 100644 356B 100644 963B 100644 2.13kB 100644 223B 100644 230B 100644 1.53kB 100644 2.44kB 100644 2.69kB
motd 100644 63B
optionaltool 100644 33B
style 100644 11B
tool 100644 351B
version 100644 7B
# mulle-vararg A variable argument passing scheme written in C (C11). It's an alternative to [stdarg](// or [varargs](//, but not compatible with either. Fork | Build Status | Release Version ----------|---------------|----------------------------------- [Mulle kybernetiK](// | [![Build Status](]( | ![Mulle kybernetiK tag]( [![Build Status](]( ## Install Install the prerequisites first: | Prerequisites | |---------------------------------------------------------| | [mulle-c11](// | Then build and install ``` mkdir build 2> /dev/null ( cd build ; cmake .. ; make install ) ``` Or let [mulle-sde](// do it all for you. ## How it works **mulle-vararg** assumes that the arguments are not layed out in stack alignment fashion but like in a struct. The C promotion rules are still observed though. > Remember the C argument promotion rules are > > 1. char and short to int/unsigned int > 2. float to double > Let's assume there is a compiler that uses **mulle-vararg** for variable arguments. It collects **all** function parameters and packs them into a struct, then passes this struct to the function. A **printf** function being being called like this: ``` printf( "%d %f %lld\n", (char) 'x', (float) 0.2, 1848LL; ``` would get its arguments embedded in a struct like this ``` struct { char *format; struct { int value1; // standard char -> int promotion double value2; // standard float -> double promotion long long value3; } varargs; } _param; ``` **mulle-vararg** provides the necessary functions to read such a struct. It has no code to create it. #### Advantages * Easy to write in C, does not need compiler ABI internals to construct or read. You don't need [libffi](// or some such. * Cheap forwarding to other functions. #### Disadvantages * Not compatible with `<stdarg.h>` ## API * [Vararg](dox/ ### Platforms and Compilers All platforms and compilers supported by [mulle-c11](// ## Author [Nat!](// for [Mulle kybernetiK](// and [Codeon GmbH](//