You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are multiple compilation warnings in the codebase and I want to try to tackle a few of them. Therefore I have a few questions:
Mismatched Types Compilation Errors
There are quite a few compilation warnings that relate to mismatched return or comparison types.
For example "int i" instead of "size_t i", which indeed should be size_t i.
But there are places where it is less obvious, for example unsigned int to int and vice versa. I was thinking of trying to figure out what would be the true appropriate type for them, but I am afraid of it breaking in certain edge cases. Would simple casting be appropriate here or is the former approach preferable?
Unused static functions
I saw that inlining them can fix it, or instead removing the warning for unusued fuctions in the flags for compilation. Is there a preferred approach? I think adding "inline" to them can solve the problem.
#pragma mark
Is this being used for something? I am compiling with GCC 9.4.0 and I get the following warning: "ignoring #pragma mark [-Wunknown-pragmas]"
The text was updated successfully, but these errors were encountered:
lior8
changed the title
Mismatched Types Compilation Errors
Compilation Warnings and Their Fixes
Nov 27, 2024
There are a few reasons for these sorts of errors. Using a static_cast would likely fix most of them correctly, but I'm a bit leery of mass replacement, given the possibility of unintended consequences.
There are multiple compilation warnings in the codebase and I want to try to tackle a few of them. Therefore I have a few questions:
There are quite a few compilation warnings that relate to mismatched return or comparison types.
For example "int i" instead of "size_t i", which indeed should be size_t i.
But there are places where it is less obvious, for example unsigned int to int and vice versa. I was thinking of trying to figure out what would be the true appropriate type for them, but I am afraid of it breaking in certain edge cases. Would simple casting be appropriate here or is the former approach preferable?
I saw that inlining them can fix it, or instead removing the warning for unusued fuctions in the flags for compilation. Is there a preferred approach? I think adding "inline" to them can solve the problem.
Is this being used for something? I am compiling with GCC 9.4.0 and I get the following warning: "ignoring #pragma mark [-Wunknown-pragmas]"
The text was updated successfully, but these errors were encountered: