Is it possible to make an enum a specific type?
I saw a {.magic: int32.} somewhere but that didn't do the trick.
I'm trying to avoid adding .UINT or .int32 when used with Win32 functions.
For example (using wNim specifically)
type UserIDs* = enum idMouseMove = WM_USER, idSize, idSlider, idAlgUpdate
Thanks
Like this:
type UserIDs* {.size: 4.} = enum
  idMouseMove = WM_USER, idSize, idSlider, idAlgUpdate
What are you trying to do exactly?
If you're binding a C function, you can declare its signature to use your enum
void do_stuff(uint32_t x) { printf("%d\n", x); }
type MyEnum {.size: 4.} = enum
  aaa = 13
  bbb
  ccc
proc doStuffFromC(x: MyEnum) {.importc: "do_stuff".}
doStuffFromC(aaa)If you want to call procs that take uint32 with your enum without adding .uint32 every time, you can define a converter
type MyEnum = enum
  aaa = 13
  bbb
  ccc
converter toUint32(x: MyEnum): uint32 = x.uint32
proc doStuff(x: uint32) = echo x
doStuff(aaa)Just make sure converter symbol is visible.