468,761 Members | 1,794 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,761 developers. It's quick & easy.

Regarding #pragma

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.

May 15 '07 #1
5 3307
venkat wrote:
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.

--
Ian Collins.
May 15 '07 #2
venkat wrote:
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.

--
Scoring, bah. If I want scoring I'll go play /Age of Steam/.

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

May 15 '07 #3
In article <11**********************@h2g2000hsg.googlegroups. com>,
venkat <ve**********@gmail.comwrote:
>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/...31/013744a.txt
--
All is vanity. -- Ecclesiastes
May 15 '07 #4
Ian Collins wrote:
venkat wrote:
>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.
(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

May 15 '07 #5
Chris Dollin wrote:
venkat wrote:
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).
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
May 15 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Steven T. Hatton | last post: by
6 posts views Thread by Shri | last post: by
1 post views Thread by Gustavo L. Fabro | last post: by
11 posts views Thread by ramu | last post: by
15 posts views Thread by muttaa | last post: by
26 posts views Thread by Rick | last post: by
2 posts views Thread by aleemakhtar1 | last post: by
debasisdas
reply views Thread by debasisdas | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.