[liblouis-liblouisxml] Re: Accidental bugs by not using braces

  • From: Michael Whapples <mwhapples@xxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Mon, 24 Feb 2014 21:22:15 +0000

I guess there are two ways of writing code: Doing what is valid and doing what is readable.


Personally I always enclose blocks in C++ and Java with braces as it makes it clearer what I mean to happen. Admittedly its not required and not as compact as it could be but I find more readable and so easier to spot mistakes.

May be that is what I really like about Python, clarity and conciseness.

Also the suggestion of running gcc with -Wunreachable-code seems sensible at least to try and catch some of the bugs (I know there have been times javac has reminded me to check my code because it warns about unreachable code blocks).

Michael Whapples
On 24/02/2014 21:09, John J. Boyer wrote:
The liblouis and liblouisutdml code has braces where they are needed. They are 
needed around multiple statements in a code block, not around single 
statements. If there were no braces where they are
needed we would have noticed the errors before now.

John

On Mon, Feb 24, 2014 at 08:45:01PM +0100, Mesar Hameed wrote:
Hi,

Not sure how many people have seen the recent apple ssl bug:
https://www.imperialviolet.org/2014/02/22/applebug.html
but it is a mistake of not using braces around code blocks to make the program
flow clear/obvious.
Unfortunately, something which we have a lot of in the liblouis code.

We should probably put a todo for running with gcc -Wunreachable-code to check
just incase.

thanks,
Mesar



For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: