Re: Infering that the condition of a for loop is initially true?

2017-09-14 Thread Geza Herman
Hi, On 09/14/2017 09:50 PM, Marc Glisse wrote: On Thu, 14 Sep 2017, Niels Möller wrote: This is more of a question than a bug report, so I'm trying to send it to the list rather than filing a bugzilla issue. I think it's quite common to write for- and while-loops where the condition is alway

layout of __attribute__((packed)) vs. #pragma pack

2017-07-28 Thread Geza Herman
Hi, There's an option in GCC "-mms-bitfields". The doc about it begins with: "If packed is used on a structure, or if bit-fields are used, it may be that the Microsoft ABI lays out the structure differently than the way GCC normally does. Particularly when moving packed data between functio

Re: Missed optimization with const member

2017-07-05 Thread Geza Herman
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

Re: Missed optimization with const member

2017-07-05 Thread Geza Herman
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

Missed optimization with const member

2017-07-04 Thread Geza Herman
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