1. A method for handling a pointer while executing program code, comprising: by an electronic device: encountering a pointer in the program code that points to an unspecified address space, wherein the pointer includes metadata that indicates one or more address spaces to which the pointer may point; and determining an address space to which the pointer points based on the metadata and one or more runtime conditions.