Use of GUID constants

thedeemon via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 10 20:47:28 PST 2016


On Thursday, 10 March 2016 at 15:48:14 UTC, Mike Parker wrote:
> Personally I would just declare one immutable value in module 
> scope and be done with it. It really just doesn't matter. 
> Unless you're following some sort of style guide, personal 
> preference rules the day. I don't know if Rainers has a special 
> reason for what he did with the Visual D code or if it was 
> personal preference.

There is one good reason for doing it VisualD way.
It defines and uses smart pointers ComPtr(ISomething) where you 
can just write

auto x = ComPtr!ISomeInterface(someObject);

and if someObject has a different COM type this constructor will 
QueryInterface() for the proper interface, and to do this it 
needs to know its IID, so a common way to get IID knowing just an 
interface type is really helpful.


More information about the Digitalmars-d-learn mailing list