Nice surprise with C++11
Daniel Gutson
daniel.gutson at tallertechnologies.com
Wed Sep 16 21:27:06 UTC 2015
Update:
fix sent https://gcc.gnu.org/ml/gcc-patches/2015-09/msg01184.html
Waiting for review.
Daniel.
On Thu, Aug 13, 2015 at 7:02 PM, Daniel Gutson
<daniel.gutson at tallertechnologies.com> wrote:
> I have been desperately busy to fix this, though we are indeed
> interested in the fix since we'll use C++14 soon.
> That's why I will address this a bit later. Sorry the delay.
>
> Daniel.
>
> On Wed, Aug 5, 2015 at 7:36 PM, Daniel Gutson
> <daniel.gutson at tallertechnologies.com> wrote:
>> On Fri, Jul 31, 2015 at 9:56 AM, Sebastian Huber
>> <sebastian.huber at embedded-brains.de> wrote:
>>>
>>>
>>> On 31/07/15 14:51, Daniel Gutson wrote:
>>>>
>>>>
>>>> > Is it possible to construct objects without an address via plain C++?
>>>>
>>>> Sorry I don't understand the question. Rephrase please?
>>>>
>>>> Global objects and objects of static storage duration don't take an
>>>> address.
>>>>
>>>
>>> This register asm variable has no address, since this is a real register.
>>> This, however, is not a problem:
>>>
>>> int *h(void)
>>> {
>>> register int i;
>>> return &i;
>>>
>>> }
>>
>> The 'register' keyword is deprecated since C++11.
>> Additionally, C++ requires that all objects have unique addresses, that's why
>> struct X{};
>> sizeof(X) > 0
>>
>> (and that's why the "empty ase class optimization" idiom exists).
>>
>> Moreover, taking the address of an object prevents such object to
>> dwell in a register.
>>
>> In your example, even in previous C++ versions, should prevent the
>> 'register' hint to be honored,
>> thus returning a temporal address to the stack (which would be invalid
>> in the caller's context).
>>
>> So the short answer is NO.
>>
>> Did I answer your question? Is there any case this should be possible?
>> (consider that I'm pursuing
>> new C++ features for embedded systems in the C++ committee).
>>
>> Daniel.
>>
>>>
>>> --
>>> Sebastian Huber, embedded brains GmbH
>>>
>>> Address : Dornierstr. 4, D-82178 Puchheim, Germany
>>> Phone : +49 89 189 47 41-16
>>> Fax : +49 89 189 47 41-09
>>> E-Mail : sebastian.huber at embedded-brains.de
>>> PGP : Public key available on request.
>>>
>>> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>>>
>>
>>
>>
>> --
>>
>> Daniel F. Gutson
>> Chief Engineering Officer, SPD
>>
>> San Lorenzo 47, 3rd Floor, Office 5
>> Córdoba, Argentina
>>
>> Phone: +54 351 4217888 / +54 351 4218211
>> Skype: dgutson
>> LinkedIn: http://ar.linkedin.com/in/danielgutson
>
>
>
> --
>
> Daniel F. Gutson
> Chief Engineering Officer, SPD
>
> San Lorenzo 47, 3rd Floor, Office 5
> Córdoba, Argentina
>
> Phone: +54 351 4217888 / +54 351 4218211
> Skype: dgutson
> LinkedIn: http://ar.linkedin.com/in/danielgutson
--
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: dgutson
LinkedIn: http://ar.linkedin.com/in/danielgutson
More information about the devel
mailing list