-
Notifications
You must be signed in to change notification settings - Fork 408
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
Explicit cast from void* to corresponding type #4
Conversation
Fix compilation without -fpermissive
In C, void* should be promoted to any pointer type without problem. Do you really compile this code with C++ compiler? |
At certain compilation flags, even C compiler can start giving warning for the implicit pointer casts, which becomes a real problem with |
Please provide a copy of a C (not C++) compiler warning for this case. For my own code I always include the warning or error message reported by the compiler in the commit message. So that it is clear what problem is solved when reviewing the PR or the commit 10 years later. |
ca647f5
to
d3af10b
Compare
My first thought was about There is @iakov why do you need have the ability to compile this source using C++ compiler? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide the warning text that is being fixed in commit message?
Well, yes, my fault. We use C++ as a main language for https://github.com/trikset/trik-studio , and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not get use to follow C best practices, so I wouldn't make a last call on this.
But I don't consider including .c/.cpp files in other .c/.cpp files as a good practice unless absolutely necessary.
Although, I don't see anything strictly wrong with this changes.
Co-Authored-By: Ihor Dutchak <[email protected]>
I prefer explicit INVALID rather than possible compiler warning about uninitialized var sometimes later
Co-Authored-By: Filip Kubicz <[email protected]>
Fix compilation without -fpermissive
Originally was PR signal11/hidapi#430