How to implement typeof operator in C
Is typeof operator available in C. If yes how to implement it. Or is there a header file I must use? I am getting the following error when I try to use the typeof statement
- Undeclared function 'typeof' (did you mean feof?); assuming extern returning int.
C is a much lower level language than Python with very little magic. It is good for low level tasks - the reference implementation of Python is written in C ...
Even if recent C version are less tolerant than good old K&R C from the 1970s (*), the rule is mainly : if the programmer knows it, there's no use the compiler care's for it. Examples :
- arrays : the programmer shall care for the size, the compiler only cares for the starting address
- variable type : the programmer should know, compiler only cares for it at compile time, but does not store information for run time
(*) there are indeed rules enforced by the compiler, but mainly at compile time : at run time the program is stripped down to a minimum