Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SomeUnsignedInt arguments silently wrap #45

Open
tersec opened this issue Mar 22, 2022 · 0 comments
Open

SomeUnsignedInt arguments silently wrap #45

tersec opened this issue Mar 22, 2022 · 0 comments

Comments

@tersec
Copy link
Contributor

tersec commented Mar 22, 2022

import confutils

type
  Command = enum
    noCommand

  IntConf = object
    case cmd {.
      command
      defaultValue: noCommand }: Command

    of noCommand:
      uint8Arg: uint8
      uint16Arg: uint16
      uint32Arg: uint32

let conf = IntConf.load()
echo "uint8Arg = ", conf.uint8Arg
echo "uint16Arg = ", conf.uint16Arg
echo "uint32Arg = ", conf.uint32Arg
$ ./env.sh nim c -r --hints:off -o:$(mktemp) intconf.nim --uint8Arg=256 --uint16Arg=65536 --uint32Arg=4294967296
uint8Arg = 0
uint16Arg = 0
uint32Arg = 0
$ ./env.sh nim c -r --hints:off -o:$(mktemp) intconf.nim --uint8Arg=257 --uint16Arg=65537 --uint32Arg=4294967297
uint8Arg = 1
uint16Arg = 1
uint32Arg = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant