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

Use null check instead of pointer comparison #701

Conversation

stevebroshar
Copy link

The original code worked for xc8 v1.44, but does not compile with v2.45. I think the compiler failure is correct. In general, from what I understand of the C standard, it's not allowed to compare pointers unless they are to the same array or structure. I don't know how the compiler would know that and don't fully understand the reasoning for the rule, but maybe it's due to segmented memory addressing.

Anyway, the change I made should be logically equivalent; comparing both expected and actual against null rather than comparing them with each other.

Also, the comment above the change line was confusing so I re-wrote it.

This change fixes the issue I added last week, #700

@mvandervoord mvandervoord merged commit b175905 into ThrowTheSwitch:master Oct 9, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants