What does double underscore ( __const) mean in C?

前端 未结 4 696
一向
一向 2020-11-22 02:52
extern int ether_hostton (__const char *__hostname, struct ether_addr *__addr)
 __THROW;

I found the above function definition in /usr/include/neti

4条回答
  •  不思量自难忘°
    2020-11-22 03:30

    Names with double leading underscores are reserved for use by the implementation. This does not necessarily mean they are internal per se, although they often are.

    The idea is, you're not allowed to to use any names starting with __, so the implementation is free to use them in places like macro expansions, or in the names of syntax extensions (e.g. __gcnew is not part of C++, but Microsoft can add it to C++/CLI confident that no existing code should have something like int __gcnew; in it that would stop compiling).

    To find out what these specific extensions mean, i.e. __const you'll need to consult the documentation for your specific compiler/platform. In this particular case, you should probably consider the prototype in the documentation (e.g. http://www.kernel.org/doc/man-pages/online/pages/man3/ether_aton.3.html) to be the function's interface and ignore the __const and __THROW decorations that appear in the actual header.

提交回复
热议问题