Gcc preprocessor typedef name replacement

Is there a way to get the gcc preprocessor to replace the type with what is defined by typedef, i.e.

something like that:

typedef unsigned char Uint8 int main(void) { Uint8 a = 1; Uint8 b = 2; Uint8 c; c = a + b; return 0; } 

Would get preprocessed in something like this:

 int main(void) { unsigned char a = 1; unsigned char b = 2; unsigned char c; c = a + b; return 0; } 
+4
source share
1 answer

No, no, because type aliases are part of the compilation stage, not the preprocessing stage. Therefore, the pre-processor cannot know anything about types by design and cannot perform any operations on these types. In addition, you forgot to put ; at the end of the typedef statement.

+2
source

Source: https://habr.com/ru/post/1441037/


All Articles