[haiku-commits] Re: haiku: hrev51585 - src/apps/powerstatus

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 21 Nov 2017 22:06:52 +0100

Hi Janus,

Am 21.11.2017 um 21:19 schrieb Janus (Redacted sender janus2 for DMARC):

This is nonsense I quit Haiku…
> 66672a5fa494: Fix broken convention

Thanks for taking the time to correct that, anyway.

Maybe you feel less heated about this when I try to explain that there are good reasons for separating methods and fields:
1. Methods and fields are very different things and contribute very differently to the object at runtime (like object size, etc.).
You may argue that the compiler already does the job of separating the two, but:
2. C++ initializers expect you to put the fields in the order of appearance in the source file, and
3. If you place several shorter fields together, they will take up less space, and
4. You sometimes need to take special care about binary compatibility. For this you must know (and not change) the size of the object at runtime, and may not change the order of the fields.

This will all benefit from grouping fields together in the class declaration.

The extra "private:" may be omitted, but I prefer to put it there, as it further separates the two sections.


Other related posts: