-
Notifications
You must be signed in to change notification settings - Fork 5
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
mkString
writes wild pointer levels in reverse order (mixes up type qualifiers)
#161
Comments
Out of curiosity, do you think the following conversion would be right? It seems to compile with the checked-c compiler and makes sense to me.
This preserves the information that a is a pointer to a const pointer to int. |
I think that's the correct conversion, but I can never remember the correct order to read C type qualifiers. |
Hear hear. Took me several visits to https://cdecl.org/ (credit to Aaron for linking me this) to wrap my head around this. Obviously, doesn't quite hold up to adding a bunch of |
What is the equivalent of |
Both |
Did you have a code example where you tested that? I tried it out and can't seem to get it to compile if I use it after. So for the following code:
I believe I'm using everything safely here, since x is a const pointer and the value it points to is free to change (if we're right), but it doesn't compile for the following reasons:
From the error, I'm assuming some sort of implicit cast to (int *) is happening when we dereference, but that should only happen if the thing we're pointing to is a |
You need put |
mkString
writes wild pointer levels in reverse order (mixes up type qualifiers)
I seem to have rediscovered this problem while working on the In the original example, the void test(void) {
int *const *volatile q = 1;
int *const *volatile *p = &q;
} Output: void test(void) {
int *const *volatile q = 1;
_Ptr<int *volatile *const > p = &q;
} I'll post some additional information on #703. |
It looks like we mess up the order of
const
s and*
s when rewriting.becomes
but checkedc-clang complains with
The text was updated successfully, but these errors were encountered: