-
Notifications
You must be signed in to change notification settings - Fork 62
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
How to add two uint16_t numbers? #41
Comments
For now, VeriFast requires that you insert a cast: uint16_t z = (uint16_t)(x + y); |
It does not work. The current VeriFast master branch gives another error: #include <stdint.h>
int to_verify()
//@ requires true;
//@ ensures true;
{
uint16_t x = 1;
uint16_t y = 38;
uint16_t z = (uint16_t)(x + y); //<-- for this line
} |
Ah, yes. The parsing of casts is brittle. This should work: uint16_t z = (unsigned short)(x + y); |
That works. Thank you. |
Update: Commit 9e8b145 fixes the cast parsing problem. (But a cast is still needed.) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I am working with
uint16_t
numbers. And I am trying simple arithmetic:➡️ Type mismatch. Actual: uint32. Expected: uint16.
How do I compute sum of two short numbers so that VeriFast accepts it?
The text was updated successfully, but these errors were encountered: