Rules for using underscore in C++ identifiers
Hi everyone! I've just started learning C++ and noticed that the underscore character `_` is used differently in various code examples. Sometimes it appears at the beginning of a variable name, like `_value` or `__value`, sometimes at the end — `value_`. And in some standard libraries, I've seen names like `_M_engine` or `__func__`.\n\nI wrote a small piece of code, and it compiled without errors:\n\n```cpp\n#include \n\nint _myVar = 10;\nint main() {\n int __anotherVar = 20;\n std::cout << _myVar + __anotherVar;\n return 0;\n}\n```\n\nBut then I read that some identifiers with underscores are reserved for the compiler and standard library. Now I'm afraid that my code might unexpectedly break or cause undefined behavior.\n\nPlease tell me, what are the
No answers yet.
Log in to leave an answer