With great power comes great responsibility

C++ itself is a pretty complex language, and C++/CLI, with its own baggage of things like handles and managed references doesn’t make it easy to read or debug code at a glance. Here’s a piece of code that had me head-scratching for a while. enum class Options { Yes, No, Maybe}; void Func(Options ^g) { Console::WriteLine(g == Options ::Yes); } void Func() { Func(Options::Yes); } If you run the above piece of code, it will print False. Pretty weird huh? It seems inexplicable, until you notice the caret sign (^) before g in the formal parameter declaration of Func. The … Continue reading With great power comes great responsibility