On Sun, Jun 27, 2010 at 05:46:28PM +0300, Nikos Chantziaras wrote:
> On 06/27/2010 03:23 PM, Harald van Dĳk wrote:
> > The compiler is not totally free to ignore the register keyword.
> > Both the C and the C++ standards require that the compiler complain
> > when taking the address of a register variable. Other compilers will
> > issue a hard error for it. Fixing the code to not declare the
> > variable as register would be the correct thing to do.
> No, it would not be the correct thing to do, because of the following.
> (This is part of a discussion between me and someone quite smarter than
> me, who explained the issue in detail.)
That explanation seems to be written by someone who does not know that
taking the address of a register variable is simply not allowed.
> OK, long read, but the the conclusion is that "fixing the code to not
> declare the variable as register would be the correct thing to do" it
> *not* the correct thing to do. The correct thing to do is to ignore the
> warning, which is not possible if warnings are turned into errors.
And which is not possible if the warning is a hard error in the first place.
> You also mentioned that "other compilers will issue a hard error for
> it." That sounds rather strange, and I wonder which compilers that
> might be; someone should file a bug report against them ;)
Well, let's start with gcc; that's quite an important one for Gentoo...