Re: PSA: DebugOnly<> fields aren't zero-sized in non-DEBUG builds

2014-07-16 Thread Benoit Jacob
That sounds like a good idea, if possible. 2014-07-16 14:41 GMT-04:00 Ehsan Akhgari : > Should we make DebugOnly MOZ_STACK_CLASS? > > > On 2014-07-15, 9:21 PM, Nicholas Nethercote wrote: > >> Hi, >> >> The comment at the top of mfbt/DebugOnly.h includes this text: >> >> * Note that DebugOnly i

Re: PSA: DebugOnly<> fields aren't zero-sized in non-DEBUG builds

2014-07-16 Thread Ehsan Akhgari
Should we make DebugOnly MOZ_STACK_CLASS? On 2014-07-15, 9:21 PM, Nicholas Nethercote wrote: Hi, The comment at the top of mfbt/DebugOnly.h includes this text: * Note that DebugOnly instances still take up one byte of space, plus padding, * when used as members of structs. I'm in the proc

Re: PSA: DebugOnly<> fields aren't zero-sized in non-DEBUG builds

2014-07-15 Thread Nicholas Nethercote
On Tue, Jul 15, 2014 at 6:33 PM, Benoit Jacob wrote: > Having to guard them in #ifdef DEBUG takes away much of the point > of DebugOnly, doesn't it? Yes. For the fields I've converted, I removed the DebugOnly<> wrapper. Nick ___ dev-platform mailing li

Re: PSA: DebugOnly<> fields aren't zero-sized in non-DEBUG builds

2014-07-15 Thread Benoit Jacob
It may be worth reminding people that this is not specific to DebugOnly but general to all C++ classes: In C++, there is no such thing as a class with size 0. So expecting DebugOnly to be of size 0 is not misunderstanding DebugOnly, it is misunderstanding C++. The only way to have empty classes beh

PSA: DebugOnly<> fields aren't zero-sized in non-DEBUG builds

2014-07-15 Thread Nicholas Nethercote
Hi, The comment at the top of mfbt/DebugOnly.h includes this text: * Note that DebugOnly instances still take up one byte of space, plus padding, * when used as members of structs. I'm in the process of making js::HashTable (a very common class) smaller by converting some DebugOnly fields to i