3 ms·
This should be handled by a code formatter, such as "go fmt". Go aligns structure definitions that way. For C and C++, there's "artistic style" (http://astyle
by Animats 12y ago
This should be handled by a code formatter, such as "go fmt". Go aligns structure definitions that way. For C and C++, there's "artistic style" (http://astyle.sourceforge.net/ http://astyle.sourceforge.net/). For maintenance purposes, it's useful to have all the modules aligned the same way. Yes, somebody will whine about it being different than "their style". Pick one and go with it for the whole project.
- ArtB 12y agoFormatting -IMHO- depends on context. I have one convention I generally use which is chaining methods together on one line, but when chaining together builder method call I make one line per call. That means the semantics not the syntactics of the code determine my formatting. For this reason I abhor auto formatting code unless it is currently like an unrecoverable mess (ie NO thoguht put into it, not just "not my style"). Honestly, put your curlies wherever you like them, then don't effect readability as much as lacking comments or convoluted flow.
- Roboprog 12y agoThank you - go fmt sucks. I hate K&R parameter layout, and I hate long lines that scroll off to the right of the screen.
- melling 12y agoYes, but it's nice to save my code and have it formatted "the official way". It gets old debating over which standard to use. Who cares what you like. Just pick a standard for every language and get used to it. It's really not that hard.
- mischanix 12y agoI'm hooked on clang-format, personally. https://mediacru.sh/1TeMS-nN5G_y https://mediacru.sh/1TeMS-nN5G_y