Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Oct 1998 09:46:55 -0700 (PDT)
From:      Matthew Dillon <dillon@backplane.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, guido@gvr.org, jb@FreeBSD.ORG, phk@critter.freebsd.dk
Subject:   Re: cvs commit: src/lib/libc_r/uthread uthread_gc.c Makefile.inc uthread_init.c uthread_find_thread.c uthread_kern.c uthread_create.c uthread_exit.c
Message-ID:  <199810021646.JAA10544@apollo.backplane.com>
References:   <199810020302.NAA10722@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help

:>    volatile int a;
:>    volatile int b;
:>
:>    code() {
:>	a = 1;
:>	b = 2;
:>    }
:
:`volatile' is not necessary here in practice, since Standard C requires
:stores to act as if they are complete at sequence points, and compilers
:attempt to implement Normal C which requires everything to work Normally
:in signal handlers.
:
:Bruce

     Uhh.... I really, really, really doubt you can count on that for
     variable operations that do not cross a procedure boundry and do not
     use the 'volatile' keyword.  The peephole optimizer alone may reorder 
     non-volatile global loads into registers.  Also, if you do not declare
     the global volatile, the compiler may optimize out 'redundant' loads
     that are, in fact, not redundant in a volatile situation.

						-Matt

    Matthew Dillon  Engineering, HiWay Technologies, Inc. & BEST Internet 
                    Communications & God knows what else.
    <dillon@backplane.com> (Please include original email in any response)    




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810021646.JAA10544>