What is #pragma directive?how it is used in the program?
what is its advantages and disadvantages?
Answer Posted / gg
See may help you some how....Answer with more clarity will
be appreciable.....
#pragma .... are documented in the GCC manual as follows.
#pragma GCC dependency
#pragma GCC dependency allows you to check the relative
dates of the current file and another file. If the other
file is more recent than the current file, a warning is
issued. This is useful if the current file is derived from
the other file, and should be regenerated. The other file is
searched for using the normal include search path. Optional
trailing text can be used to give more information in the
warning message.
#pragma GCC dependency "parse.y"
#pragma GCC dependency "/usr/include/time.h"
rerun fixincludes
#pragma GCC poison
Sometimes, there is an identifier that you want to
remove completely from your program, and make sure that it
never creeps back in. To enforce this, you can poison the
identifier with this pragma. #pragma GCC poison is followed
by a list of identifiers to poison. If any of those
identifiers appears anywhere in the source after the
directive, it is a hard error. For example,
#pragma GCC poison printf sprintf fprintf
sprintf(some_string, "hello");
will produce an error.
If a poisoned identifier appears as part of the
expansion of a macro which was defined before the identifier
was poisoned, it will not cause an error. This lets you
poison an identifier without worrying about system headers
defining macros that use it.
For example,
#define strrchr rindex
#pragma GCC poison rindex
strrchr(some_string, 'h');
will not produce an error.
#pragma GCC system_header
This pragma takes no arguments. It causes the rest of
the code in the current file to be treated as if it came
from a system header
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
How are portions of a program disabled in demo versions?
What are the types of data files?
what is bit rate & baud rate? plz give wave forms
What are the salient features of c languages?
What is the maximum length of an identifier?
What is local and global variable in c?
Multiply an Integer Number by 2 Without Using Multiplication Operator
Explain what does a function declared as pascal do differently?
What is the use of volatile?
How do I use strcmp?
how to count no of words,characters,lines in a paragraph.
What are shell structures used for?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
Array is an lvalue or not?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above