6/10 Hi, what is "volatile function" in C (or is it C++)? Thanks.
\_ They're used when writing vaporware.
\_ I imagine it's a method that operates on a volatile object (?)
\_ Uhm, no... that wouldn't make much sense, now, would it?
I've never used or see someone use "volatile" in all the
years that I've been coding C (it's been 15+ years now).
According to K&R the volatile modifier is used only
variables that supposedly could be modified outside of
the executing program. In the years since the original
K&R during ANSI meetings there has been some debate over
what "volatile" actually means and there hasn't been
a satisfactory answer. I've never heard of anyone using
"volatile" on declaring a function, I'm not even sure
if that would pass the compiler...
-williamc
\_ Wow, way to look like a fucking dumbass again. "Just
because I've never seen volatile used means it, like,
doesn't make sense, or something!" Here's a snippet
from the C++ standard:
"[Note: volatile is a hint to the implementation to
avoid aggressive optimization involving the object
because the value of the object might be changed by
means undetectable by an implementation... In general,
the semantics of volatile are intended to be the same
in C++ as they are in C."
And in C, the volatile type specifier generally denotes
something like a memory-mapped IO address, so it's not
some totally abstract theoretical thing.
\_ Or a variable modified by a signal handler.
\_ Google says that they are functions that can return control
to some point other than where they were called from.
\_ Uhm, that would be highly problematic.... -williamc
\_ Uhm, you are an idiot. This is about as problematic as
exceptions (that's exactly what they are designed to do).
Now I am sure volatile isn't implementing exceptions in C,
but your comment's ignorant regardless.
\_ Actually, it would be highly problematic in a C program,
because C doesn't implement exception handling.
It's apparent that YOU have never done any C
programming (no, this is not Java, and C++ exception
handling is still pretty broken). In addition,
you appear to fail to understand how exception
handling is implemented in general. -williamc
\_ Ok, let me try small words. Poster: "functions that
can return control to some point other than where
they were called from." You: "That [returning control
in this way] would be highly problematic." Except
this is NOT highly problematic because that's exactly
what exceptions do. You are a moron.
\_ It is nice to see people get hot and bothered and
make fools out of themselves by flaming on a topic
other than politics. Sir, I salute you for caring
so much about typecast functions.
\_ (Why) I oughta (knock) your block++ off;{!!;}
\_ You've never heard of setjmp and longjmp?
\_ youse guys are all cracka's!
\_ have any of you ever kissed a girl?!? |