On 12/12/2014 10:20 AM, Florian Weimer wrote: > open is declared as: > > int open(const char *pathname, int flags, ...); > > The intent is to have two overloaded variants: > > int open(const char *pathname, int flags); > int open(const char *pathname, int flags, mode_t mode); > > The presence of the mode argument depends on the flags specified. The > set of such flags is known by the kernel. I wish to avoid to maintain > this implementation detail in libc as well, so I want to always read the > mode argument, possibly passing a garbage value to the kernel. > > Is there GCC-portable way to achieve this? You're assuming that for all targets the varargs calling convention is the same as the non-varargs calling convention, at least for integer registers. I don't think this is true for all targets, although it might be true for the targets GCC supports today. Andrew.