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

Consider issuing a warning when a bare integer is used in Cat() or Repl() #639

Closed
whitequark opened this issue Oct 2, 2021 · 2 comments
Closed
Milestone

Comments

@whitequark
Copy link
Member

whitequark commented Oct 2, 2021

In general, using bare integers in bit vector context is error-prone because the width of the integer, when cast to a Value, will change with its value. Values other than 0 and 1 are very likely to indicate a potential issue. Whether we want to allow 0 and 1 is an open question, but I suspect that people are relying on that.

@adamgreig
Copy link
Contributor

adamgreig commented Oct 2, 2021

I've definitely used 0 and 1 inside Cat a bunch for adding an extra bit, in situations like the UART example where it's convenient for shift registers, but it's not that bad to use Const either. I think the meaning is pretty clear with 0 and 1 though.

I checked and about 10% of my Cat calls use a bare 0 or 1.

@whitequark
Copy link
Member Author

whitequark commented Oct 2, 2021

Okay, definitely no warning on bare 0 or 1.

@whitequark whitequark added this to the 0.3 milestone Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants