Re: My whitespace style

看板FB_chat作者時間17年前 (2009/04/15 16:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/9 (看更多)
On Wed, 15 Apr 2009 06:48:12 +0200, deeptech71@gmail.com wrote: > Could you please give me a (preferrably widely used) example of > columnizing calls which cross different levels of indentation? It's not so uncommon as it may initially seem... I've seen switch() cases in several programs indented like this: switch (value) { case SOME_CONSTANT_NAME: do_stuff_here(); break; case ANOTHER_CONSTANT_NAME: do_some_other_stuff(); break; default: default_stuff(); break; } I find this style horrible to read, but it does come with its own variation of TAB- and space-related issues and it is apparently attractive to a lot of people. Composite structure initializations also use a style similar to this, and will almost invariably end up looking horrendously misformatted when TAB sizes are 'elastic', i.e.: struct foo { long magic; const char *name; struct { int curr; int next; } nested; }; const struct foo statetab[] = { { 1, "one", { 1, 2}, }, { 1, "one", { 2, 2}, }, { 1, "one", { 3, 1}, }, { 1, "one", {65535, 1}, }, { 2, "two", { 1, 1}, }, { 2, "two", { 2, 2}, }, { 2, "two", { 3, 65535}, }, { 2, "two", {65535, 1}, }, ... { 65535, "invalid", { 1, 1}, }, { 65535, "invalid", { 2, 1}, }, { 65535, "invalid", { 3, 1}, }, { 65535, "invalid", {65535, 1}, }, }; This sort of alignment tends to generate *lots* of diff output when the alignment of a column changes, but it is often used for state transition tables of automata, and similar constructs. _______________________________________________ freebsd-chat@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-chat To unsubscribe, send any mail to "freebsd-chat-unsubscribe@freebsd.org"
文章代碼(AID): #19vPk300 (FB_chat)
討論串 (同標題文章)
文章代碼(AID): #19vPk300 (FB_chat)