DECLARE_ID - useful pattern from projucer


#1

This is a super-cute macro from a Projucer header file.

namespace Ids
{
    #define DECLARE_ID(name)      const Identifier name (#name)

    DECLARE_ID (name);
    DECLARE_ID (file);
    DECLARE_ID (path);
}

It works, but how does this avoid a problem with multiple definitions? Presumably there’s some rule somewhere that allows it.

https://stackoverflow.com/questions/1563897/c-static-constant-string-class-member