【问题标题】:Why does the Linux C API 'open' support function overloading? [duplicate]为什么 Linux C API 'open' 支持函数重载? [复制]
【发布时间】:2015-05-05 23:50:18
【问题描述】:

根据the Linux manual page,Linux C APIopen有两个原型如下:

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

让我困惑的是:

为什么 Linux C API 'open' 支持函数重载?

【问题讨论】:

    标签: c linux api overloading


    【解决方案1】:

    不,C 不支持函数重载。

    POSIX open 函数实际上是一个可变参数函数,它的签名是:

    int open(const char *path, int oflag, ... );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-18
      • 1970-01-01
      • 2011-03-17
      • 1970-01-01
      • 2011-03-24
      • 2011-04-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多