Regarding #pragma

V

venkat

Hi,

I have come across the a pragma definition " #pragma switch direct ".
I don't know any thing about pragma's. Even i when i search through
google not getting exact information. what does pragma does?. what the
statment "#pragma switch direct" does?.

Thanks,
Venkat.
 
I

Ian Collins

venkat said:
Hi,

I have come across the a pragma definition " #pragma switch direct ".
I don't know any thing about pragma's. Even i when i search through
google not getting exact information. what does pragma does?. what the
statment "#pragma switch direct" does?.
You'll have to look in you compiler's documentation for that one.
 
C

Chris Dollin

venkat said:
I have come across the a pragma definition " #pragma switch direct ".

(That's not a pragma definition; it's a /use/.)
I don't know any thing about pragma's. Even i when i search through
google not getting exact information. what does pragma does?. what the
statment "#pragma switch direct" does?.

Whatever the documentation for the compiler that that code was
intended to be compiled on says.

Pragmas are (generally) not portable and their effect is not defined
by the Standard. Whoever wrote the code was -- I hope -- using an
implementation that defined what "#pragma switch direct" meant.
So you need to know what implementation that was, so you can consult
its documentation (or perhaps the programmer who pragmaed).

You could hope -- I would -- that all the pragma did was alter
performance tradeoffs, such as saying "always implement switches
with direct jump tables, not linear or binary search or the
built-in swizzy-but-slow ciscy-switch instruction". But until
you see the documentation, it might mean "the compiled code
connects the mains power directly though the unearthed casing
switch", and you should wear rubbur gloves and boots any time
you run the program.
 
W

Walter Roberson

venkat said:
I have come across the a pragma definition " #pragma switch direct ".
I don't know any thing about pragma's. Even i when i search through
google not getting exact information. what does pragma does?. what the
statment "#pragma switch direct" does?.

It does something compiler specific.

I found -a- definition fairly easily with google; google for
"#pragma-switch" and it's the first link that mentions #pragma
in the results text.

http://techref.massmind.org/techref/piclist/2004/01/31/013744a.txt
 
C

Chris Dollin

Ian said:
You'll have to look in you compiler's documentation for that one.

(It might not be /his/ compiler that's relevant -- see my other reply.)

--
Is it a bird? It is a plane? No, it's: http://hpl.hp.com/conferences/juc2007/
WARNING. Various parts of this product may be more than one billion years old.

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England
 
D

Default User

Chris said:
(That's not a pragma definition; it's a use.)


Whatever the documentation for the compiler that that code was
intended to be compiled on says.

Pragmas are (generally) not portable and their effect is not defined
by the Standard. Whoever wrote the code was -- I hope -- using an
implementation that defined what "#pragma switch direct" meant.
So you need to know what implementation that was, so you can consult
its documentation (or perhaps the programmer who pragmaed).

The latest standard did add a few standard pragmas. As the one
mentioned above doesn't begin with STDC, it is not one of those.




Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top