ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RP] register variable considered BAD


From: shawn
Subject: Re: [RP] register variable considered BAD
Date: Mon, 07 May 2001 23:13:19 -0700

>
>Was reading the Gnu CC manual again.  It had this interesting
>tidbit:  When the address of a variable is taken, it will never
>be assigned a register.  EVER.  Even if the register keyword
>was used.  I believe this is the case with the code in ratpoison
>that does use register, and that would be why I noticed no
>code difference in the generated object files when I compiled
>with and without the register keyword.  If you want to actually
>use registers, don't give the compiler hints, use inline assembly.

Hmm, what about this:

void *
xmalloc (size_t size)
{
#ifdef YOU_ARE_DJW
  void *value = malloc (size);
#else
  register void *value = malloc (size);
#endif
  if (value == 0)
    fatal ("Virtual memory exhausted");
  return value;
}

That should satisfy everyone...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]