CPow asks: “Why does this give an error? This makes no sense. I smell a radar…?”
Answer: To the best of my understanding, the compiler sees that literal as an integer and is trying to use it with a
UInt initializer. If you explicitly make sure the compiler understands that the literal is a
UInt and not an
Int, the problem disappears.
(As Joe Groff points out, you obviously don’t need the
UInt() in the “c” example, but I was trying to build off CPow’s question.)
Got a better explanation for CPow? Please let me know!