Why do some functions / variables have the symbol "_" in front of them, in C ++?

I have seen quite a lot lately, in games or other applications, that members of a data class, or methods or other things have a "_" in front of the name. For example, for DXUT.cpp (Directx) _Acquires_lock_(g_cs)or _Releases_lock_(g_cs)or _tmain. There are many examples like this in game programming, for example there (taken from GameFromScratch Tutorial).

  static GameState _gameState;
  static sf::RenderWindow _mainWindow;

These are just some data members of some type.

Is there a reason for _ char? Is there something for something?

+4
source share
3 answers

Usually, when you see a top-underlined name, it either

  • belongs to an implementation (C ++), or

  • -, .

.

, , , , , , .

, .


- " ".

, , / m my.

. , - Boost, m my (-, ) MFC.

+12

_Acquires_lock_(g_cs) _Releases_lock_(g_cs)

, , .

, , , , .

, , - - , API.

+2

(_) , ++ . .

" ++?" ++ ( ).

-8
source

Source: https://habr.com/ru/post/1628313/


All Articles