On 07/07/2017 06:26 AM, Ion Gaztañaga wrote:
On 05/07/2017 17:24, Martin Sebor wrote:
[*] While the example (copied below) is valid, accessing the object
after someFunction() has returned via a reference or pointer to it
is not.
void somefunction(const Object& object);
{
void* p = &
On 05/07/2017 17:24, Martin Sebor wrote:
[*] While the example (copied below) is valid, accessing the object
after someFunction() has returned via a reference or pointer to it
is not.
void somefunction(const Object& object);
{
void* p = &object;
object.~Object();
new(p) Obj
On Wed, Jul 5, 2017 at 12:14 PM, Jonathan Wakely wrote:
> On 5 July 2017 at 10:13, Oleg Endo wrote:
>> Hi,
>>
>> On Wed, 2017-07-05 at 02:02 +0200, Geza Herman wrote:
>>>
>>> Here's what happens: in callInitA(), an Object put onto the stack (which
>>> has a const member variable, initialized to 0)
On 07/05/2017 01:26 PM, Geza Herman wrote:
On 07/05/2017 01:14 PM, Jonathan Wakely wrote:
I think the reason it's not optimized away is for this case:
void somefunction(const Object& object);
{
void* p = &object;
object.~Object();
new(p) Object();
}
This means that after calling someF
On 07/04/2017 06:02 PM, Geza Herman wrote:
Hi,
I've included a small program at the end of my email.
Here's what happens: in callInitA(), an Object put onto the stack (which
has a const member variable, initialized to 0). Then somefunction called
(which is intentionally not defined). Then ~Obje
On Wed, 2017-07-05 at 12:14 +0100, Jonathan Wakely wrote:
>
> No, that would be undefined behaviour. The data member is defined as
> const, so it's not possible to write to that member without undefined
> behaviour. A variable defined with a const type is not the same as a
> variable accessed thro
On 07/05/2017 01:14 PM, Jonathan Wakely wrote:
I think the reason it's not optimized away is for this case:
void somefunction(const Object& object);
{
void* p = &object;
object.~Object();
new(p) Object();
}
This means that after calling someFunction there could be a different
object at
On 5 July 2017 at 10:13, Oleg Endo wrote:
> Hi,
>
> On Wed, 2017-07-05 at 02:02 +0200, Geza Herman wrote:
>>
>> Here's what happens: in callInitA(), an Object put onto the stack (which
>> has a const member variable, initialized to 0). Then somefunction called
>> (which is intentionally not defined
Hi,
On Wed, 2017-07-05 at 02:02 +0200, Geza Herman wrote:
>
> Here's what happens: in callInitA(), an Object put onto the stack (which
> has a const member variable, initialized to 0). Then somefunction called
> (which is intentionally not defined). Then ~Object() is called, which
> has an "if
Hi,
I've included a small program at the end of my email.
Here's what happens: in callInitA(), an Object put onto the stack (which
has a const member variable, initialized to 0). Then somefunction called
(which is intentionally not defined). Then ~Object() is called, which
has an "if", which
10 matches
Mail list logo