On 02/07/2011 10:33 AM, Maarten Brock wrote:
> I disagree because compilers will probably generate warnings when the
> developer relies on precedence without forcing it.
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> Am 06.02.2011 18:28, schrieb Borut Razem:
>>> - Philipp, what about changing the coding style of *.cc and *.hpp to be
>>> sdcc compliant?
>>> astyle --style=gnu --pad-oper --pad-header<source_file>
>> Personally, I prefer the Allman style, but I've now run astyle to change
>> it to the GNU style used throughout sdcc.
I also haven't use the gnu coding style until I started to work on FOSS
projects and I still don't use it for private projects. But the majority
of sdcc is written using gnu coding style, so I think we should stick
The most important (by my opinion) is to use spaces instead tabs. This
solves the inconsistent indentation problems on different IDEs, since
they have different ideas what the TAB length should be (8, 4 or 2 spaces).
>> However there's one little change in sdcc coding style I'd like to
>> propose: GNU style mandates parentheses around logical or:
>> if((A&& B) || C)
>> instead of
>> if(A&& B || C)
>> which is meant to help people that don't know about operator precedence.
>> IMO&& taking precedence over || is as natural as for * over +, since&&
>> takes precedence over || in all of computer science just as * does over
>> + in math. Furthermore sdcc being a C compiler, sdcc developers probably
>> know more about operator precedence than the average programmer. I
>> therefore suggest that the latter style (the one without extra
>> parentheses) be allowed in sdcc.
I don't have problems with this, unless the compilers are complaining
with warnings, as Maarten noted.