Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the Linux C API 'open' support function overloading? [duplicate]

According to the Linux manual page, the Linux C API open has two prototypes as follows:

int open(const char *pathname, int oflags);
int open(const char *pathname, int oflags, mode_t mode);

What makes me confused is:

Why does the Linux C API 'open' support function overloading??

like image 854
xmllmx Avatar asked Jan 18 '26 02:01

xmllmx


1 Answers

No, C doesn't support function overloading.

The POSIX open function is actually a variadic function, its signature is:

int open(const char *path, int oflag, ... );
like image 175
Yu Hao Avatar answered Jan 19 '26 16:01

Yu Hao



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!