Jump to content

Double underscores

- - - - -

  • Please log in to reply
1 reply to this topic

#1
DarkLordofthePenguins

DarkLordofthePenguins

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 409 posts
In C, what does a word preceded by two underscores mean? I've seen this used for starting inline Assembly code and I've also seen __BEGIN_DECLS and __END_DECLS in standard header files. What are these directives used for, generally speaking?
Programming is a journey, not a destination.

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
In a general (only recommended) effort to keep names from collision, single underscores denote library identifiers, i.e.
_exit(0);
_internal_foo(2);

Two underscores (at least put in paper in ISO:14882:'98 C++), even in any part of the identifier, denotes a vendor defined identifier.
__FILE__
__LINUX__
__CLR_VER (vendor as MSVC)
__FGETS_UNLOCKED (vendor as gcc)

Alexander.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users