tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Rationale for some rules in style guide



Am Wed, Apr 12, 2023 at 05:16:55AM -0700 schrieb Carlo Arenas:
> On Wed, Apr 12, 2023 at 5:07 AM Joerg Sonnenberger <joerg%bec.de@localhost> wrote:
> >
> > Am Wed, Apr 12, 2023 at 09:17:49AM -0000 schrieb Michael van Elst:
> > > joerg%bec.de@localhost (Joerg Sonnenberger) writes:
> > >
> > > >Which compiler from this century doesn't allocate stack space
> > > >independent from the source order?
> > >
> > > gcc with -O0 and -O1 allocates variables in source order.
> >
> > More by accident, not guaranteed.
> 
> FWIW clang also does with -O0, not sure if it proves it is a common
> mistake to make or there might be some intention to it.

It's not a mistake. Just that -O0 (and for gcc, -O1) effectively ask the
compiler "just do whatever is easiest". Given how bad code generation in
those modes is anyway, it's completely pointless to argue and optimize
for this mode.

Joerg


Home | Main Index | Thread Index | Old Index