4 ms·
Don't align. void my_function( int arg1, int arg2, int arg3, ... ) {
by scrollaway 10y ago
Don't align.
void my_function(
int arg1, int arg2, int arg3,
...
) {
- hamax 10y agoI also much prefer this way of breaking long lines. Aligning parameters always looked ugly to me, specially with long function names.
- CJefferson 10y agoWhile I quite like that style, now you have to convince people to never align, before you can convince them to use tabs. I've not seen any large public code-bases uses this style, so it's hard to know how well it works in practice. Do you know of any major projects with a 'no alignment' requirement?
- MatmaRex 10y agoMediaWiki uses tabs for indentation and discourages alignment. https://www.mediawiki.org/wiki/Manual:Coding_conventions https://www.mediawiki.org/wiki/Manual:Coding_conventions
- realharo 10y agoI also like a rule that states that you either put all the parameters on one line, or each one on its own separate line, but never something in between.
- exDM69 10y agoI don't think blindly following any convention is good. Sometimes it makes sense to group a few parameters, take this toy example for instance: void drawrect( Surface *surf, int x, int y, int width, int height, uint32_t color); Grouping relevant arguments just makes it a bit more legible. It's even more useful when calling the said function (assuming function with a lot of parameters, say XCreateWindow).