Inline qualifier stems from prototype or definition?

后端 未结 4 2292
鱼传尺愫
鱼传尺愫 2021-02-13 18:55

I\'m not quite sure about this in the standards. Say I have three files like this:

foo.h

#include 

inline void foo();

         


        
4条回答
  •  北荒
    北荒 (楼主)
    2021-02-13 19:18

    Odds are that your clang uses C99 inline semantics. In C99, if one of your functions doesn't use "inline" or does include "extern", then the definition is an "external definition", which can only appear once in the program. See inline in C99.

    In C++, your program is fine. In Clang SVN, this bug has been fixed and your program should work fine.

提交回复
热议问题