Am Wed, Apr 12, 2023 at 07:53:23AM +0930 schrieb Brett Lymn: > On Tue, Apr 11, 2023 at 08:30:19PM +0200, Roland Illig wrote: > > > > The style guide says: > > > When declaring variables in functions declare them sorted by size > > > > What is the purpose of this rule, and is it still useful? I'd rather see > > the variables grouped by topic. If that rule's purpose is to help some > > ancient compiler lay out the variables efficiently, I don't see a point > > in keeping that rule, as modern compilers are advanced enough. > > > > To save stack space? If you mix up the sizes of the variables then > there would be wasted memory due to alignment constraints for accessing > a certain sized variable. Those constraints are processor not compiler > artifacts. Unless compilers are smart enough to reorder the variables > to pack them efficiently in memory then it is still a good idea to do > this
Which compiler from this century doesn't allocate stack space independent from the source order? Joerg