volatile qualified parameters

  • Thread starter Vijay Kumar R Zanvar
  • Start date
V

Vijay Kumar R Zanvar

Hello,
I have a question: when do we use volatile
qualified function parameters?

Vijay
 
C

Christian Bau

"Vijay Kumar R Zanvar said:
Hello,
I have a question: when do we use volatile
qualified function parameters?

When we want to confuse the reader.

Seriously, if you intend to modify a function parameter or any other
local variable of a function between a call to setjmp and a
corresponding call to longjmp then you must make that function parameter
or local variable volatile in order to avoid undefined behavior. You
shouldn't use volatile qualification in the function declaration because
it is just plain pointless and only confusing (qualifiers like volatile
or const are just ignored at that point), but only in the implementation
of the function.

And if you use this as an answer to your homework, then everyone will
know that you didn't write it yourself :)
 

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

Forum statistics

Threads
474,142
Messages
2,570,819
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top