Platform-independent GUID generation in C++?

后端 未结 6 1473
余生分开走
余生分开走 2020-12-02 10:27

What is the best way to programmatically generate a GUID or UUID in C++ without relying on a platform-specific tool? I am trying to make unique identifiers for objects in a

6条回答
  •  失恋的感觉
    2020-12-02 10:59

    A GUID generator usually relies on hardware characteristics of the machine, usually stuff like MAC addresses or IPs. The only thing you can do which is absolutely platform independent is use some kind of PRNG seeded manually or seeded from some time source. This usually does not generate a true globally unique identifier in the sense that you are guaranteed that no one in the world generates the same number.

提交回复
热议问题