TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: John Richardson
from: George White
date: 1998-09-29 23:20:06
subject: Tutorial questions?

Hi John,

JR> > const volatile int foo;
JR> >
JR> > Which means the program itself may not modify foo, but some sort of
JR> > background process (e.g. an interrupt) may change the value behind our
JR> > back.

JR>Hmm. I'll take your word for it, but such a statement does seem
JR>contradictory to me. I'll see if it works on my compiler.

It isn't. I code for systems that use a multi-port serial interface
which includes its own processor (a 16 MHz 80186). These cards
communicate with the main PC processor via a block of shared memory. If
a veriable is used to return data from the serial card, it is const as
far as the main program is concerned, because it isn't allowed to modify
it, but it is also volatile because the serial card can change it's
value at any time. The "volatile" keyword tells the compiler to read the
variable from memory everytime it is referenced in the code as something
other than the program can change it.

JR>Is it a new (post 94) modification to the standard?

It's always been so afaiaa.

George

 * SLMR 2.1a * Computers eliminate spare time.

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-717904) (2:440/4)
SEEN-BY: 396/1 632/0 371 633/260 267 270 371 634/397 635/506 728 810 639/252
SEEN-BY: 670/218
@PATH: 440/4 255/1 251/25 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.