Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Nikos Chantziaras <realnc@...>
Subject: Re: FYI: Rules for distro-friendly packages
Date: Sun, 27 Jun 2010 20:48:25 +0300
On 06/27/2010 08:14 PM, Harald van Dijk wrote:
> On Sun, Jun 27, 2010 at 05:46:28PM +0300, Nikos Chantziaras wrote:
>> On 06/27/2010 03:23 PM, Harald van Dijk 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.)
>>
>> [snip]
>
> That explanation seems to be written by someone who does not know that
> taking the address of a register variable is simply not allowed.

It is allowed.  Section 7.1.1, Paragraphs 2 and 3 of the C++ standard:

The register specifier [...] specifies that the named variable has 
automatic storage duration (3.7.3). A variable declared without a 
storage-class-specifier at block scope or declared as a function 
parameter has automatic storage duration by default.

A register specifier is a hint to the implementation that the variable 
so declared will be heavily used. [ Note: the hint can be ignored and in 
most implementations it will be ignored if the address of the variable 
is taken. This use is deprecated (see D.4). — end note ]


>> 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...

That code compiles just fine.  I don't know of any GCC version that 
issues an error for this rather than just a warning.



Replies:
Re: FYI: Rules for distro-friendly packages
-- dev-random
References:
Re: FYI: Rules for distro-friendly packages
-- Petteri Räty
Re: FYI: Rules for distro-friendly packages
-- Enrico Weigelt
Re: FYI: Rules for distro-friendly packages
-- Ciaran McCreesh
Re: FYI: Rules for distro-friendly packages
-- Enrico Weigelt
Re: FYI: Rules for distro-friendly packages
-- Ciaran McCreesh
Re: FYI: Rules for distro-friendly packages
-- Nikos Chantziaras
Re: Re: FYI: Rules for distro-friendly packages
-- Enrico Weigelt
Re: FYI: Rules for distro-friendly packages
-- Nikos Chantziaras
Re: Re: FYI: Rules for distro-friendly packages
-- Harald van Dijk
Re: FYI: Rules for distro-friendly packages
-- Nikos Chantziaras
Re: Re: FYI: Rules for distro-friendly packages
-- Harald van Dijk
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: Re: FYI: Rules for distro-friendly packages
Next by thread:
Re: FYI: Rules for distro-friendly packages
Previous by date:
Re: Policy for late/slow stabilizations
Next by date:
Re: Policy for late/slow stabilizations


Updated Jun 29, 2012

Summary: Archive of the gentoo-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.