in linux
#include <stdio.h>
main()
{
printf("\n This print is from line %d of file %s",_LINE_,_FILE_);
}
i use cc and gcc, but it prompt _LINE_ and _FILE_ is undefined,
but _LINE_,_FILE_,_DATE_ and _TIME_ are predefined macro?
in linux
#include <stdio.h>
main()
{
printf("\n This print is from line %d of file %s",_LINE_,_FILE_);
}
i use cc and gcc, but it prompt _LINE_ and _FILE_ is undefined,
but _LINE_,_FILE_,_DATE_ and _TIME_ are predefined macro?
According to the MSDN, __LINE__, __FILE__, __DATE__, __STDC__, __TIME__, __TIMESTAMP__ are all predefined ANSI C macros. The trick is that there are two underscore characters '_' before and after these macros and it looks as though you may have only put a single character before and after in your examples.
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
can you tell me what is __STDC__ and what type is it?
The macro __STDC__ is defined if a compiler supports the ANSI C standard.
The macro __TIMESTAMP__ is both the build date and the build time.
Peter O. Programming tips