RE: (*(unsigned long *)&jiffies)++;

From: David Schwartz (davids@webmaster.com)
Date: Thu Jan 06 2000 - 14:51:03 EST


> On Thu, Jan 6, 2000, Andrea Arcangeli <andrea@suse.de> wrote:
>
> >>(*(unsigned long *)&jiffies)++;
> >>
> >>why not just jiffies++; ? It works fine with jiffies++ but I
> assume there
> >>is a reason...
> >
> >No reason. It won't make any difference.
> >
> >You could as well do jiffies++. jiffies is volatile so it can't be
> >reodered across other `;' and it won't be cached into registers.
>
> Actually, I'm wondering if the explicit may even kill the volatile
> attribute, thus allowing re-ordering... sounds bogus to me.

        Exactly. What's the point of declaring it as volatile if you're later going
to cast the volatile away? The compiler has the right to ignore the fact
that it's volatile at that point.

        DS

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 07 2000 - 21:00:07 EST