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
Does free set pointer to null?
What is the difference between printf and scanf in c?
At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with these names could be kept in that shelf as in this example: bottom of shelf ---> [AAAJKRDFDEWAAYFYYKK]-----Top of shelf. All these packets are to be loaded on cars. The cars are lined in order, so that the packet could be loaded on them. The cars are also named [A, B, C, D, E,………….]. Each Car will load the packet with the same alphabet. So, for example, car ‘A’ will load all the packets with name ‘A’. Each particular car will come at the loading point only once. The cars will come at the loading point in alphabetical order. So, car ‘B’ will come and take all the packets with name ‘B’ from the shelf, then car ‘C’ will come. No matter how deep in the shelf any packet ‘B’ is, all of the ‘B’ packets will be displaced before the ‘C’ car arrives. For that purpose, some additional shelves are provided. The packets which are after the packet B, are kept in those shelves. Any one of these shelves contains only packets, having the same name. For example, if any particular shelf is used and if a packet with name X is in it, then only the packets having names X will be kept in it. That shelf will look like [XXXXXXX]. If any shelf is used once, then it could be used again only if it is vacant. Packets from the initial shelf could be unloaded from top only. Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.
Why #include is used in c language?
What is clrscr in c?
hi send me sample aptitude papers of cts?
What does typedef struct mean?
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
What are pointers in C? Give an example where to illustrate their significance.
What is an auto variable in c?
What is meant by high-order and low-order bytes?
How do we make a global variable accessible across files? Explain the extern keyword?
How can I convert a number to a string?
What is null pointer constant?