In the process of studying, this idea of using typedef appeared:
#include<stdio.h> typedef int height; typedef int width; typedef int mul; mul sq(height,width); int main(){ width h=5;/*or 'int' or other type*/ width w=17; printf("%d\n",sq(h,w)); } mul sq(height h,width w){ return h * w; } but the chip failed. And, as expected, I received not what I wanted. I realized that in my example the function is similar to this:
int sq(int h,int w){ return h * w; } And it would be desirable that when accepting a function of the wrong type, there would be an error or a compiler warning. How to implement it?
__builtin_choose_expr(__builtin_types_compatible_p(...))in macro format. - NewView