trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: January 2015

Re: [trinity-devel] Codebase formatting discussion

From: Michele Calgaro <michele.calgaro@...>
Date: Sat, 17 Jan 2015 23:46:32 +0900
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 2015/01/17 11:30 PM, Sl�vek Banko wrote:
> First of all: I was in earlier days very busy, so I did not manage
> to follow and respond to the debate on coding style. Now I will try
> gradually respond to individual discussed cases.
> 
> 
> On Friday 09 of January 2015 23:33:01 Timothy Pearson wrote:
>> Ah, OK, that is a valid complaint.  The case style shown above is
>> fine and we'll go with that.
>> 
>> My only remaining question then is should we also be forcing
>> whitespace between each case block for legibility, something like
>> this?
>> 
>> do_something(); switch(foo)  { case bar: a=1; break;
>> 
>> case baz: { a=2; ...long case block... c=4; break; }
>> 
>> case asd: a=3; break;
>> 
>> default: a=0; } do_something_else();
> 
> Here I would like to advocate for the previously mentioned
> principle braces even where they are not required. By this I mean
> that each 'case' consider as block => each case should to have
> brackets, including 'default':
> 
> do_something(); switch(foo)  { case bar: { a=1; break; }
> 
> case baz: { a=2; ...long case block... c=4; break; }
> 
> case asd: { a=3; break; }
> 
> default: { a=0; } } do_something_else();
> 
> The advantage is that regardless of the size of the 'case' is
> easily traceable beginning of the block => editor can be used to
> trace paired brackets. With this would also not need white space
> between each 'case'. By the way, I wont give white space anyway.
> :)
> 

This is good for me too, I actually almost wanted to propose it myself :-)
Cheers
  Michele
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCgAGBQJUunXIAAoJECp1t8qK3tXP4y4P/ih91aj9mBaORQDb5MxuXlyF
8iG4RJFb1Fyy8bkOeti+u2F5jskd6diqAT7UF9KrsuIaMDmC446/fPWd6/+1sxWT
fVqjk4w9A+mW/lf817gdkO7pb30DE94YDB1rw7sPrnuzFqYv1mkGaJdiy/h3W/dZ
N5geCPKd2zwPXt4pc2KuvmWD53UUe/aoY1+2XBWHiZJJWB7+PfPWBBfmmDbbPbkB
J9zWwLgHfkGkpOKnzf0vdFvp2L7E79PyW1cwIIW/chLE0ATYy1ArmH7CAj7xa9ZH
VbTkq3HnG7Vji/tQ7Xilsuf9M2slv4Ua+B2ZRsQ2iJwEZdHyyBY99y09oaOEPFfj
D3RRzyGmZBJvU9dLqoCoyV7eAvcaENcdeRsqaKdAQfYDOap/7u0TrEIyKTiTAybk
7tBlDGSQZ+AGw9NV9Pi7ZaHRboyRA06E5dTD4shjLTbjwGBrIDIW31BquCRzWvAP
z7ECkZK5H8pIY/b9wlNgXHH1HZNaUUAowsaGkFv5cmXnIDZkfY0KJnhKE8fLK41l
iQNQKNb9wVAlp6xmtVLrxPDRUZhQWGYKQmIgXy7pzyKxu3v2HDUKQCfWwW2YhaRa
r4g6GbU5X5bweuagdiSTRqyrNAo34vGjO7F6mDJ6dJYW/kTJXcKzpOiqT8WJt18L
L/0qUkGcZkW64OscaDkC
=b65W
-----END PGP SIGNATURE-----