Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Mar 1999 23:40:01 -0700
From:      Warner Losh <imp@harmony.village.org>
To:        dyson@iquest.net
Cc:        alk@pobox.com, chat@FreeBSD.ORG
Subject:   Re: Use of "register" in code 
Message-ID:  <199903170640.XAA07832@harmony.village.org>
In-Reply-To: Your message of "Wed, 17 Mar 1999 01:32:13 EST." <199903170632.BAA03094@y.dyson.net> 
References:  <199903170632.BAA03094@y.dyson.net>  

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

In message <199903170632.BAA03094@y.dyson.net> "John S. Dyson" writes:
: Warner Losh said:
: > In message <14063.12923.464399.183283@avalon.east> Anthony Kimball writes:
: > : Firstly, removing "register" declarations from a program can
: > : cause correct code to become incorrect code.  This is true, not only
: > : of ANSI C, but of the GNU C 2 series compilers, as well as other
: > : significant current compilers, such as Microsoft and SunPro.
: > 
: > How?  I can think of no way that removing the register part of a
: > declaration can cause this (eg register int foo -> int foo).
: > 
: It is possible because of setjmp type things.  However, the use of
: register can be replaced by "auto?"

Aren't those value indeterminate, even in the face of regsiter?
Reliance on those values would make the program not strictly
conforming.  From the setjmp man page:

     All accessible objects have values as of the time longjmp()
     routine was called, except that the values of objects of
     automatic storage invocation duration that do not have the
     volatile type and have been changed between the setjmp()
     invocation and longjmp() call are indeterminate.

Having something be register or not doesn't impact if it is automatic
storage or not, unless I've misread the standard.  In fact, all
register variables are, by definition, automatic since that is the
only type you can apply register to.

I'm sure the better language lawyers will correct me if I'm wrong.

Warner


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message



home | help

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