_Symbols _with _leading _underscores

Adam D Ruppe destructionator at gmail.com
Sat Dec 17 16:47:53 UTC 2022


On Saturday, 17 December 2022 at 02:42:22 UTC, Paul wrote:
> Are the leading underscores significant, in general, in the D 
> language?

The code you linked is a copy/paste from some C runtime library 
code, where the leading __ is the convention to indicate it is 
part of the private platform implementation, which user code 
shouldn't use. This ensures no name conflicts.

D has this rule too, you're actually not supposed to use __ 
prefixes in your own code either, since the compiler will use it 
for auto-generated names. But since it was a copy paste, I was 
too lazy to change it.

A single leading _ is sometimes used by some programmers to 
indicate private members, but that's no special meaning in the 
language.


More information about the Digitalmars-d-learn mailing list