Mon Jan 10 11:48:11 2005

Ticket #538 (Closed: fixed)

compound statement formatting


Priority: low Reporter: maroy
Severity: text Assigned to: fgerlits
Component: bug Status: closed
Version:   Resolution: fixed
Milestone:   Keywords:  

Description by maroy:

in a lot of places, compund statements are formatting in the following manner: try { ... } catch (...) { ... } wheras the appropriate, more readable formatting would be: try { ... } catch (...) { ... } (the same for if .. else statements) maybe the code convention document was a bit lax in describing this...

Attachments

Changelog

Mon Jan 10 13:19:30 2005: Modified by fgerlits

    Actually, I find the second style less readable, more crowded, with insufficient visual separation between the try and the catch blocks. But if you insist...

    Mon Jan 10 13:21:57 2005: Modified by maroy

      I do... :)

      Thu Jan 13 11:52:56 2005: Modified by fgerlits

        But why? Even you implicitly agree it's too crowded, because more often than not, you write try { statement; } catch (Exception &e) { statement; } I.e., you put a blank line in the middle. How is this better than the first style above? Please give at least one reason. "Appropriate" has no meaning, and "more readable" is highly subjective.

        Thu Jan 13 14:55:00 2005: Modified by maroy

          it's subjective, I aggree. this is the nature of coding conventions. as I define the coding convention for this project, obviously there's a subjective bias to my side. but, for background, please see the SUN Java Coding conventions: http://java.sun.com/docs/codeconv/html/CodeConventions.doc6.html#430 what I require is basically the same as there.

          Thu Jan 13 15:42:29 2005: Modified by fgerlits

          • resolution set to fixed
          • status changed from assigned to closed

          I changed them already, and I also did a web search which gave similar documents as this one. For some conventions, they give a reason, e.g. if (condition) singleStatement; // error-prone int a, *b; // error-prone which is fine; for others, they don't. I was curious whether there was any reason for this ugly try-catch formatting that I'm not seeing. I guess there isn't.


          Add/Change #538 (compound statement formatting)




          Change Properties






          Action