Click here to Skip to main content
14,659,317 members

The Insider News

   

The Insider News is for breaking IT and Software development news. Post your news, your alerts and your inside scoops. This is an IT news-only forum - all off-topic, non-news posts will be removed. If you wish to ask a programming question please post it here.

Get The Daily Insider direct to your mailbox every day. Subscribe now!

 
GeneralRe: Writing more succinct C# Pin
Eddy Vluggen11-May-20 4:59
professionalEddy Vluggen11-May-20 4:59 
GeneralRe: Writing more succinct C# Pin
Member 798912211-May-20 6:27
MemberMember 798912211-May-20 6:27 
GeneralRe: Writing more succinct C# Pin
Eddy Vluggen11-May-20 7:06
professionalEddy Vluggen11-May-20 7:06 
GeneralRe: Writing more succinct C# Pin
Member 798912211-May-20 7:14
MemberMember 798912211-May-20 7:14 
GeneralRe: Writing more succinct C# Pin
Eddy Vluggen11-May-20 7:23
professionalEddy Vluggen11-May-20 7:23 
GeneralRe: Writing more succinct C# Pin
David O'Neil11-May-20 5:10
professionalDavid O'Neil11-May-20 5:10 
GeneralRe: Writing more succinct C# Pin
Nelek11-May-20 7:13
protectorNelek11-May-20 7:13 
GeneralRe: Writing more succinct C# Pin
Member 798912211-May-20 7:33
MemberMember 798912211-May-20 7:33 
E.g. the Coverity analyzer pinpoints such problem as those you point out. (But you have to do the reformatting yourself)

In any case: If you have a code formatter that enforces code layout according to a complete set of rigid rules, then it doesn't matter if the coder writes the code in the way you indicate - the formatter will fix it.
If the formatter does not enforce a rigid set of rules, or if the rule set is incomplete, then there will always be ways in which the coder could mess up things.

So we are talking about either which rules should a formatter enforce, or which rules should the coders write theuir code by. When I am not under the control of some other coding style, among the rules I follow are

* You never have an indent without a bracing construct (which one is language dependent)
* You never have a bracing construct without an indentation.
* You never have a statement separator (such as a semicolon) anywhere but at the end of a line.
* If the body of a structured statement (such as an if) is a single statement (and need no bracketing) and it fits within a line lenght of 80, they it might be accepted on the same line. Otherwise, and it is moved to the next line, it must be indented and braced (according to the first rule).


Having programmed by these rules for thirty years, it would take me a lot of pain to break them. I would never accept it in code that I am responsible for.
GeneralRe: Writing more succinct C# Pin
#realJSOP11-May-20 1:11
mva#realJSOP11-May-20 1:11 
GeneralRe: Writing more succinct C# Pin
Member 798912211-May-20 1:32
MemberMember 798912211-May-20 1:32 
GeneralRe: Writing more succinct C# Pin
#realJSOP11-May-20 2:05
mva#realJSOP11-May-20 2:05 
GeneralRe: Writing more succinct C# Pin
Member 798912211-May-20 6:19
MemberMember 798912211-May-20 6:19 
GeneralRe: Writing more succinct C# Pin
Kevin McFarlane11-May-20 6:45
MemberKevin McFarlane11-May-20 6:45 
NewsScientists obtain 'lucky' image of Jupiter Pin
Kent Sharkey10-May-20 10:00
staffKent Sharkey10-May-20 10:00 
GeneralRe: Scientists obtain 'lucky' image of Jupiter Pin
Nelek11-May-20 7:16
protectorNelek11-May-20 7:16 
NewsMicrosoft may have tipped the Windows 10 May 2020 Update release date Pin
Kent Sharkey10-May-20 9:45
staffKent Sharkey10-May-20 9:45 
NewsMicrosoft publishes the agenda for its Build 2020 virtual event Pin
Kent Sharkey10-May-20 9:30
staffKent Sharkey10-May-20 9:30 
NewsWork-from-home mandates may be DevOps' shining moment Pin
Kent Sharkey10-May-20 9:15
staffKent Sharkey10-May-20 9:15 
GeneralRe: Work-from-home mandates may be DevOps' shining moment Pin
#realJSOP11-May-20 1:13
mva#realJSOP11-May-20 1:13 
NewsMicrosoft adds protection against Reply-All email storms in Office 365 Pin
Kent Sharkey10-May-20 9:15
staffKent Sharkey10-May-20 9:15 
GeneralRe: Microsoft adds protection against Reply-All email storms in Office 365 Pin
Nelek11-May-20 7:19
protectorNelek11-May-20 7:19 
GeneralRe: Microsoft adds protection against Reply-All email storms in Office 365 Pin
ZurdoDev11-May-20 10:08
mveZurdoDev11-May-20 10:08 
GeneralRe: Microsoft adds protection against Reply-All email storms in Office 365 Pin
Dan Neely12-May-20 2:21
MemberDan Neely12-May-20 2:21 
GeneralRe: Microsoft adds protection against Reply-All email storms in Office 365 Pin
MadMyche12-May-20 5:45
mveMadMyche12-May-20 5:45 
NewsScience confirms it, web sites really do all look the same nowadays Pin
Jörgen Andersson9-May-20 6:46
professionalJörgen Andersson9-May-20 6:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.