linux系统调用函数相干的函数重载
linux系统调用函数相关的函数重载
最近在看linux的一些书籍时,发现有些系统调用函数是函数名是一样的,如下面的:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
小弟有些不明白,不是说C 语言不支持函数重载么?为什么这儿可以有同样的函数名?
------解决思路----------------------
int open(const char *pathname, int oflag, ... );
可变参数
最近在看linux的一些书籍时,发现有些系统调用函数是函数名是一样的,如下面的:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
小弟有些不明白,不是说C 语言不支持函数重载么?为什么这儿可以有同样的函数名?
------解决思路----------------------
int open(const char *pathname, int oflag, ... );
可变参数