What is #pragma directive?how it is used in the program?
what is its advantages and disadvantages?
Answers were Sorted based on User's Feedback
Answer / kapil thakar
#pragma is used to give specific instruction to compiler...
like used only reg bank 3..
then
#pragma BANK_3
used be witten in ur code..
another example..
#pragma worning_3
display worning upto level 3
There are many more pragma dependent on compiler ...
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / 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 |
How can I ensure that integer arithmetic doesnt overflow?
program to locate string with in a string with using strstr function
What is null pointer constant?
Given a number N, product(N) is the product of the digits of N. We can then form a sequence N, product(N), product(product(N))… For example, using 99, we get the sequence 99, 99 = 81, 81 = 8. Input Format: A single integer N Output Format: A single integer which is the number of steps after which a single digit number occurs in the sequence. Sample Test Cases: Input #00: 99 Output #00: 2 Explanation: Step - 1 : 9 * 9 = 81 Step - 2 : 8 * 1 = 8 There are 2 steps to get to this single digit number. Input #01: 1137638147
main() { struct test { char c; int i; char m; } t1; printf("%d %d\n", sizeof(t1), sizeof(t1.c)); }
1 Answers Vector, Vector India,
What are pointers? What are different types of pointers?
What does nil mean in c?
How do you generate random numbers in C?
write a program for 7*8 = 56 ? without using * multiply operator ? output = 56
Main must be written as a.the first function in the program b.Second function in the program c.Last function in the program d.any where in the program
19 Answers CTS, HCL, TCS,
do u print this format '(((())))'. This brackets is based on user input like 4 or 5 or 6,without using any loop's?
How can draw a box in cprogram without using graphics.h header file & using only one printf(); ?