Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftunsafeBitCast and pointersSingle-choice MCQ

Examine this code that reinterprets a class instance as an integer. Why is reading the result as a stable identity questionable beyond the immediate use?

final class Node {} let n = Node() let bits = unsafeBitCast(n, to: Int.self) // is `bits` a stable identity for the lifetime of the program?