-
preprocessor directives
I am just doing some research. I have been to some of these websites just looking at some of the rare preprocessor directives:
http://msdn.microsoft.com/library/de...directives.asp
http://www.acm.uiuc.edu/webmonkeys/b....7.html#pragma
http://cboard.cprogramming.com/showt...ghlight=pragma
I was just wondering if anyone would be generouse enogh to write a little code using some of the awkward ones like:
#pragma
#line
#using
I think I sort of understand the using one but not sure. Is it like compiling with another object file(.o) I would really appreciate anyone's suggestions.
P.S. I have also found questions on the board on the #pragma and #line but still don't understand
-
I'm assuming you've used google alread so:
not using vc++ so don't know about here is some the first I found on a site and modified it, the second I coded to test writing macros with the #define directive
Code:
/**
** This example illustrates some predefined macros.
**/
#pragma langlvl(ANSI)
#include <stdio.h>
#if __STDC__
# define CONFORM "conforms"
#else
# define CONFORM "does not conform"
#endif
int main(void)
{
system("TITLE C macros");
printf("Line %d of file %s has been executed\n", __LINE__, __FILE__);
printf("This file was compiled at %s on %s\n", __TIME__, __DATE__);
printf("This program %s to ANSI/ISO standard C\n", CONFORM);
system("vol");
getchar();
return 0;
}
Here is one site that talks about macros.