Re: [dev] [sbase] style

From: Marc André Tanner <mat_AT_brain-dump.org>
Date: Wed, 19 Nov 2014 12:36:54 +0100

On Mon, Nov 17, 2014 at 10:47:31PM +0100, FRIGN wrote:
> On Mon, 17 Nov 2014 13:24:21 -0800
> Evan Gates <evan.gates_AT_gmail.com> wrote:
> > blocks
> > ======
> > all variable declarations at top of block

Why? In general I prefer declarations to be in the closest to the actual
usage (in the inner most scope).

> > static if not used outside current file (what's the right term?
> > compilation unit?)
>
> scope.

No, translation unit.

> > C version
> > =========
> > use C99 (why not C11? I really like anonymous unions/structs)
>
> suckless default is a mix of C90 and C99. C11 is a mess.
>
> > do not use for loop initial declarations (why?)
>
> Well it's part of "declarations at top of file". Since I stopped using it
> I found out how nicely you can recycle index-integers for multiple loops. :)

No, I never understood this preference. It makes it clear that the
variable is only used in the current scope. Recycling index-integers
for mulitple loops makes the code less readable. The compiler will
generate the same code anyway.

-- 
 Marc André Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0
Received on Wed Nov 19 2014 - 12:36:54 CET

This archive was generated by hypermail 2.3.0 : Wed Nov 19 2014 - 12:48:08 CET