You guys take this so seriously.
Maybe you should find a hobby. ;-)
Though I understand, I'm afflicted by the same malady.
Just a slightly different strain.
Here's a fix, no need to ever again deal with my coding style (one of many possible tools): http://uncrustify.sourceforge.net/
If you object to K&R style, there's a lot of it out there for you to sic crustify on.
Here's a few million lines to get you started: https://github.com/torvalds/linux
> You can also use Ctrl-T to format your code to a common C coding style.
I assume that's for the Arduino IDE, whose editor I mostly avoid.
Here's various tricks for vi/vim users: https://stackoverflow.com/questions/2355834/how-can-i-autoformat-indent-c-code-in-vim
Here's a discussion of the various indentation styles: https://softwareengineering.stackexchange.com/questions/99543/what-is-the-difference-between-kr-and-one-true-brace-style-1tbs-styles
They can't agree either.
But somebody in there did a study of error rates in code using the various styles.
Note that K&R style won, at least by a little bit.
Though perhaps that's because folks using the K&R style
are more likely to have read K&R (highly recommended).
I was quite serious about that back pocket thing.
If I have a difficult algorithm to work on, I code it tight so I can see
as much of the work at one time as possible. Preferably so it all fits
on one side of a sheet of typing paper. Better yet, half of one side.
Then pull it out at odd times during the day, jot notes when new insights come.
Works for me.
Didn't anybody have any comments about on how better to compute SWR?
On Sun, May 6, 2018 at 05:31 pm, Jack Purdum wrote:
Braces or brackets? Braces mark statement/function blocks while brackets are most often used with array sizes. The old K&R style was to leave the opening brace on the same line as the expression block, and then align the closing brace with the expression block start. I think that was done to get more lines on the screen when a 25 line display was common. Today, most seem to place the opening brace on its own line. If the block spans more than a page, the latest IDE shows the opening expression.
You can also use Ctrl-T to format your code to a common C coding style.