0

I've been reading some of the WebRTC source code and saw this interesting construction to define a constant:

namespace webrtc {
  enum { kNameOfConstant = 200 };
  // ...
}

Personally, I would have written const int kNameOfConstant = 200;. What's the advantage of writing constants in this way, using an anonymous enum with a single member? Thanks!

fyhuang
  • 2,067
  • 5
  • 20
  • 24

0 Answers0