Re: ANSI C question about 'volatile'
From: j0mbolar (j0mbolar_at_engineer.com)
Date: 08/13/04
- Next message: Profetas: "File i/o"
- Previous message: Keith Thompson: "Re: main function"
- In reply to: Eric Sosman: "Re: ANSI C question about 'volatile'"
- Next in thread: Eric Sosman: "Re: ANSI C question about 'volatile'"
- Reply: Eric Sosman: "Re: ANSI C question about 'volatile'"
- Reply: Chris Torek: "Re: ANSI C question about 'volatile'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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?
- Next message: Profetas: "File i/o"
- Previous message: Keith Thompson: "Re: main function"
- In reply to: Eric Sosman: "Re: ANSI C question about 'volatile'"
- Next in thread: Eric Sosman: "Re: ANSI C question about 'volatile'"
- Reply: Eric Sosman: "Re: ANSI C question about 'volatile'"
- Reply: Chris Torek: "Re: ANSI C question about 'volatile'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|