Created
April 15, 2023 13:17
-
-
Save imaami/92b38f45142f8a8390fefa2d972bc63d to your computer and use it in GitHub Desktop.
Backport of C23's typeof_unqual in plain C18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define typeof_unqual(x) __typeof__(((void)1, *(__typeof__(x) *)(void *)0)) | |
int main(void) { | |
const int ci = 1; | |
typeof_unqual(ci) i1 = ci; | |
typeof_unqual(const int) i2 = ci; | |
i1 = 0; | |
i2 = 0; | |
return i1 + i2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment