www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19028] New: Emit warning for identifiers starting with `__`


          Issue ID: 19028
           Summary: Emit warning for identifiers starting with `__`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: regnellday protonmail.com

Identifiers starting with `__` are reserved for compiler and their behaviour is
implementation-defined. But compilers do not show warning or error message when
you try to use such names. Furthermore, some functions ignore these identifiers
and may produce hidden bugs in a code. For example:

void main()
    writeln([__traits(allMembers, S)]); // will print only ["a"]

struct S
    int a;
    int __refCount;

Documentation of `allMembers` says nothing about this behaviour.

https://forum.dlang.org/thread/yauflbmphapnnksckksu forum.dlang.org

Jun 26 2018