about the #pragma

R

rwen2012

Hi, guys,

I am confused with the preprocessor instruction #pragma.

What does the #pragma mean?
and what does this mean as follow?

====================
#pragma intterupt Timer
====================

any reply is appreciated.
 
K

Kenneth Brody

Hi, guys,

I am confused with the preprocessor instruction #pragma.

What does the #pragma mean?
and what does this mean as follow?

====================
#pragma intterupt Timer
====================
[...]

Pragmas are, by definition, implementation defined. They basically
say "hey, compiler, do something special here". What that "something"
is is entirely up to the compiler.

As to what your particular pragma does, you would have to check the
documentation for the particular compiler that was used to compile
the code.

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 
K

Keith Thompson

Hi, guys,

I am confused with the preprocessor instruction #pragma.

What does the #pragma mean?
and what does this mean as follow?

====================
#pragma intterupt Timer
====================

any reply is appreciated.

You posted the same article twice. Google seems to encourage this for
some reason.

A #pragma directive "causes the implementation to behave in an
implementation-defined manner" (except for a few of the form
"#pragma STDC ..."that are defined by C99). You'll have to consult
the documentation for your compiler to find out what "#pragma interrupt"
means.
 
D

Default User

Hi, guys,

I am confused with the preprocessor instruction #pragma.

What does the #pragma mean?
and what does this mean as follow?

====================
#pragma intterupt Timer
====================

any reply is appreciated.


Except for a few pragmas defined in the 1999 standard, almost anything
used with the #pragma directive is platform-specific and questions
should be directed to a newsgroup dedicated to that platform. I don't
know what compiler you are using, but a newsgroup for it is the place
to ask.



Brian
 
R

Roberto Waltman

Keith Thompson said:
A #pragma directive "causes the implementation to behave in an
implementation-defined manner" (except for a few of the form
"#pragma STDC ..."that are defined by C99). You'll have to consult
the documentation for your compiler to find out what "#pragma interrupt"
means.

A function called as an ISR (interrupt service routine) may be called
at any time, in the middle of the execution of other functions.
To ensure that the original interrupted code can continue executing,
in most cases the interrupt pragma modifies the entry/exit code the
compiler will generate for a function, making it save (and restore on
exit) additional information about the processor state. It could save
more registers, floating point processor state, temporarily disable
interrupts, etc.
The details will change from system to system. As Keith wrote, only
the documentation for your compiler/environment will provide you with
more information.
 
R

rwen2012

thank you all very much,
after read these, I have got the main idea of what the #pragma means.

thanks a lot!

Rwen.
 
S

santosh

Keith said:
You posted the same article twice. Google seems to encourage this for some reason.

Well, my posts to this group are currently over 400 and I've yet to
make a double/multiple post. AFAICS, it's not Google's fault, rather
it's the poster. Though currently I use an ADSL connection, I've used a
56K dial-up modem for many years. Often, it's so slow, that you might
get tempted to press the 'reply' button twice, thinking the site has
stalled.

Of course, there're also people who post multiple times, simply to get
a rise out the group. They may come from a web forum background, which
are much more lax on posting discipline.
 
D

Default User

santosh said:
Keith Thompson wrote:

Well, my posts to this group are currently over 400 and I've yet to
make a double/multiple post. AFAICS, it's not Google's fault, rather
it's the poster.

This is not true, it's just that you've been lucky not to encounter the
problem. Sometimes Google will report that there was an error and the
message couldn't be sent, but in fact it has. It happens. It happened
to me when I used Google last year.



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

Similar Threads


Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top