🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #9235

Re: Lattice 4.1 register yuck!

#9235
From: dillon
Date: Thu, 30 Jun 1988 07:21
53 lines
2230 bytes
>where that variable couldn't be re-used, if the value was no longer needed.
>In other words, if I had a situation like the one above, I would just say
>	"register int i"
>and just let 'i' handle all those loops.  I don't see any need to allocate
>two more variable to do the work that the first one could have done.

	Please, don't remark on my lack of a good example.  I *DID* say
that this comes up (all that time in my case) not when you have the 
same type, but differing types... usually differing pointer types.

FOREXAMPLE, I might want to put a passed pointer variable in a register
so I can initialize some other structure, but beyond that never use
the passed pointer variable again.

poof(ss)
register SOMESTRUCTURE *ss;
{
    register BLAH *blah;
    ss->x = 43;
    ss->t = 23;
    ss->querty = "hello";
    blah->ss = ss;
    blah
    blah
    blah ...

    <lots of code that never uses ss again>
}

In my case, this occurs often enough that I use up all the available
registers and then I'm up shit creek.  Using sub code blocks only 
partially fixes the situation.

>	I believe it would be dangerous to let the compiler re-use a variable
>in the manner that you describe, especially when using a debugger.  If you
>check the address and/or value of 'i' or 'j', they would be the same, and
>you would think that a bug has been found.

	I won't argue with you too much, since you are obviously unaware 
that this is a standard compiler design practice.

>that it should work properly.  I would just like to point out that it is
>easy enough for the programmer to detect these situations, and use the
>register variable over "manually".

	I'm glad you agree with me, though I disagree with your last
remark.

>
>							-- Glenn
>

					-Matt
Technical Details
Message-ID: <8806300721.AA14302@cory.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!bellcore!faline!thumper!ulysses!andante!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!CORY.BERKELEY.EDU!dillon

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!bellcore!faline!thumper!ulysses!andante!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!CORY.BERKELEY.EDU!dillon
From: dillon@CORY.BERKELEY.EDU.UUCP
Newsgroups: comp.sys.amiga.tech
Subject: Re: Lattice 4.1 register yuck!
Message-ID: <8806300721.AA14302@cory.Berkeley.EDU>
Date: 30 Jun 88 07:21:44 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 53