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