Codingstyle for the UbiTrack? Library. Check back often for new rules. All rules are guidelines only. You are advised to always know what you're doing.
See also the PointerGuide
class Foo { public: Foo( int x ) : m_myMember( x ) , m_member2( 3 ) { } int doIt() { ... } }
(defconst ubitrack-c-style '( (c-basic-offset . 4) (c-comment-only-line-offset . 0) (c-echo-syntactic-information-p . t) (c-toggle-auto-hungy-state . t) (c-cleanup-list . ( empty-defun-braces defun-close-semi list-close-comma scope-operator space-before-funcall compact-empty-funcall)) (c-hanging-braces-alist . ((class-open after before) (class-close after before) (defun-open after before) (defun-close after before) (inline-open after before) (inline-close after before) (brace-list-open) (brace-list-close) (brace-list-intro) (brace-list-entry) (brace-entry-open) (block-open after) (block-close . c-snug-do-while) (statement-case-open after before) (substatement-open after before) (extern-lang-open after before) (extern-lang-close after before) (namespace-open) (namespace-close after) (inexpr-class-open after before) (inexpr-class-close after before))) (c-hanging-colons-alist . ((case-label after) (label after) (access-label after) (member-init-intro before) (inher-intro before))) (c-offsets-alist . ((string . c-lineup-dont-change) (c . c-lineup-C-comments) (comment-intro . c-lineup-comment) (class-open . 0) (class-close . 0) (defun-open . 0) (defun-close . 0) (defun-block-intro . +) (inline-open . 0) (inline-close . 0) (extern-lang-open . 0) (extern-lang-close . 0) (func-decl-cont . 0) (topmost-intro . 0) (topmost-intro-cont . 0) (member-init-intro . +) (member-init-cont . -2) ; woher kommt das +2? (inher-intro . +) (inher-cont . -2) (block-open . 0) (block-close . 0) (brace-list-open . 0) (brace-list-close . 0) (brace-list-intro . 0) (brace-list-entry . 0) (brace-entry-open . 0) (statement . 0) (statement-cont . 0) (statement-block-intro . +) (statement-case-intro . +) (statement-case-open . 0) (substatement . +) (substatement-open . 0) (case-label . 0) ; +? (access-label . -) (label . 0) (do-while-closure . 0) (else-clause . 0) (catch-clause . 0) (comment-intro . 0) (arglist-intro . +) (arglist-cont . c-lineup-arglist) (arglist-cont-nonempty . c-lineup-arglist) (arglist-close . c-lineup-arglist) (stream-op . c-lineup-streamop) (inclass . +) ; here ;(cpp-macro . 0) (cpp-macro-cont . c-lineup-dont-change) (friend . 0) (extern-lang-open . 0) (extern-lang-close . 0) (inextern-lang . +) (namespace-open . 0) (namespace-close . 0) (innamespace . 0) (template-args-cont . (c-lineup-template-args +)) (inexpr-statement . +) (inexpr-class . +) )) ) "c style for ubitrack")
(defun my-c-mode-common-hook () (c-add-style "ubitrack" ubitrack-c-style t) (setq tab-width 4) (c-toggle-auto-hungry-state t) (define-key c-mode-base-map "\C-m" 'newline-and-indent) (modify-syntax-entry ?_ "w" c++-mode-syntax-table) (modify-syntax-entry ?_ "w" c-mode-syntax-table) (setq paragraph-start (concat paragraph-start ;; include some common HTML tags "\\|</?\\([ou]l\\|li\\|d[tdl]\\|p\\|br\\)>")) ) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)