-
Notifications
You must be signed in to change notification settings - Fork 38
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
Suggest using volatile attribute on ptYielded #3
Comments
Sorry for not responding to this earlier! I'm curious (and I haven't written a lot of C for a while): why doesn't the |
Alternatively, you could use |
This will cast it to the type void. The compiler then seems to think that the value is used because it was casted. |
|
If protothread does not have any PT_YIELD() in its Run method then compiler produces a warning, that ptYielded is set but never used.
I suggest using volatile attribute on ptYilded so compiler won't optimize (void) ptYielded; statement and won't produce any warnings.
#define PT_BEGIN() bool volatile ptYielded = true; (void) ptYielded; switch (_ptLine) { case 0:
For example I have this code without any PT_YILED()
The text was updated successfully, but these errors were encountered: