Skip to content

Typenameof

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Typenameof Type

typenameof can be used to get the name of a compile-time type as a C-String.

typenameof Type

Result Type

The resulting value will be a *ubyte null-terminated string.

Usage Example

import basics

struct Thing ()

func main {
    thing *Thing = null

    printNameOfType(thing)
}

func printNameOfType(_something *$T) {
    printf("You passed a pointer to %s\n", typenameof $T)
}
You passed a pointer to Thing

Note

As opposed to older methods of using RTTI for the same effect, the usage of typenameof does not require runtime type information to be enabled.

Clone this wiki locally