Re: ANSI C question about 'volatile'

From: j0mbolar (j0mbolar_at_engineer.com)
Date: 08/13/04


Date: 13 Aug 2004 11:53:59 -0700

Eric Sosman <Eric.Sosman@sun.com> wrote in message news:<411CD4EA.5070402@sun.com>...
> Chris Torek wrote:
> > In article <gadoh0hjn24jfius0g343jvo6sgu9r2b57@4ax.com>
> > Jack Klein <jackklein@spamcop.net> writes:
> >
> >>Since the semantics of the source code specify that the function
> >>accesses the object exactly once, a conforming implementation may not
> >>access a volatile object more or less than once.
> >
> >
> > On the other hand, the same C Standard says:
> >
> > ... What constitutes an access to an object that has
> > volatile-qualified type is implementation-defined.
> >
> > which leaves the implementor a truck-sized loophole: he can simply
> > define away all but one of the actual memory references, leaving
> > only one of them as an "access".
> >
> > I would encourage people not to buy such an implementation, though. :-)
>
> Hard to avoid such gaps, I think.
>
> struct s {
> double trouble;
> char coal[2048];
> long long way_to_tipperary;
> };
> volatile struct s s1;
> struct s s2;
> ...
> s2 = s1;
>
> Most implementations, I think, would be forced to define the
> single C-level "access" to `s1' in terms of multiple hardware-
> level "accesses."

this begs the question, what in the world is multiple hardware-level
accesses? and how does this affect something volatile?



Relevant Pages

  • Re: Shea 65 audio sweetening technical questions
    ... Why even go through the trouble of sync'ing the record (and leaving ... a couple of gaps out to keep it in sync) than to simply add the vocal. ...
    (rec.music.beatles)
  • Re: 82 year old ticketed for slow walking
    ... I don't care how good a driver you are, ... avoid ALL possible crash scenarios (unless you never get into a car at ... I don't think it is true to say that you CAN'T avoid all ... prevents one from leaving a safe zone. ...
    (rec.autos.driving)
  • Re: Ferraris start at Malaysia
    ... at the start of today's grand prix. ... Where they asleep or something? ... Leaving huge gaps for others to drive into is unforgiveable. ...
    (rec.autos.sport.f1)
  • Re: Beginner needs help choosing microcontroller platform & software
    ... > I'd appreciate any advice you could send my way. ... I want to avoid the ... > probability of me getting bored or frustrated and leaving hundreds of ...
    (comp.robotics.misc)
  • Tom Golisano to NY: "Drop Dead!"
    ... Tom Golisano says he is leaving, I don't blame him what with his ... 2011 and avoid a double-dip recession in 2012. ...
    (sci.econ)