#How do I convert a raw input into a string?

1 messages · Page 1 of 1 (latest)

limpid jackal
#

I want to create a function that automates something like
print_name_and_value :: proc(some_type: $T)
where I can write
print_name_and_value(frame_header_descriptor.Frame_Content_Size_flag)
and it can do the equivalent of

fmt.println("frame_header_descriptor.Frame_Content_Size_flag:",
            frame_header_descriptor.Frame_Content_Size_flag,
            fmt.tprintf("%8b", frame_header_descriptor.Frame_Content_Size_flag))

Thanks in advance :)

heavy garden
#

That requires macros, which is not in Odin

gray wren
#

woud this help?

dbg :: proc(x: any, expr := #caller_expression(x)) {
  fmt.printfln("%s: %v", expr, x)
}
limpid jackal
heavy garden
#

interesting

limpid jackal