[squid-dev] Coding Style updates

Amos Jeffries squid3 at treenet.co.nz
Thu Aug 12 04:42:25 UTC 2021

Hi all,

  Now that we have astyle 3.1 for style enforcement we can take 
advantage of it to perform a few code style change that older versions 
could not.

Before I do any work testing they work I'd like to review the relevant 
details of our style guidelines and see if we actually want to keep that 

1) return type on separate line from function definition.

Current style requirement:


AFAIK, this based on GNU project style preferences from the far past 
when Squid had a tight relationship with GNU. Today we have a conflict 
between Factory code coming in with the alternative same-line style 
and/or various developers being confused by the mix of code they are 

IMO; it is easier to work with the one-line style when command-line 
editing, and irrelevant when using more advanced tools.

As such I propose converting Squid to the same-line style:

   void foo(...)


Any reasons I missed for keeping this?

2) braces on one-liner conditional blocks

Current code style is a bit confused. We have it as a style to use, with 
exceptions for some old macros etc where the lack of braces causes 
compile issues or bugs.

Personally I prefer the non-braced style. But it seems far safer to 
automate the always-brace style and not have those special exceptions.



More information about the squid-dev mailing list