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

assertion for string should take const char * instead of char * #521

Open
Tracked by #535
2LeoCode opened this issue Feb 21, 2024 · 1 comment
Open
Tracked by #535

assertion for string should take const char * instead of char * #521

2LeoCode opened this issue Feb 21, 2024 · 1 comment

Comments

@2LeoCode
Copy link

2LeoCode commented Feb 21, 2024

when doing for example:

const char * foo = "foo";

cr_assert(eq(str, foo, "foo"));

we get a compiler warning because eq(str, ...) expects a char * as second argument, so we loose the const qualifier for foo, but it should take a const char * instead

EDIT

same for ptr, should take const void *, but takes void * (I guess it's the same for every typed pointers too)

@jakeru
Copy link

jakeru commented Mar 8, 2024

Right! This issue is similar to #512.

As a workaround you may use cr_expect_str_eq() for strings and cr_expect_arr_eq to compare arrays. Both are part of the "old" API.

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

No branches or pull requests

2 participants