I use this command to start emacs
$ emacs -Q c-mode-test.el
then I use C-xC-e to eval every line
(require 'cc-mode)
(add-hook 'c-mode-common-hook '(lambda () (print "hello")))
(add-hook 'c-mode-hook '(lambda () (print "hello c")))
(c-mode)
after this, the minibuffer shows
"hello"
"hello c"
"hello c"
nil
and c++-mode-hook run just the same
(add-hook 'c++-mode-hook '(lambda () (print "hello c++")))
(c++-mode)
the minibuffer
"hello"
"hello c++"
"hello c++"
nil
why it run twice or something wrong.