help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Comment out some lines in a c preprocessor (cpp) file will cause the com


From: Hongyi Zhao
Subject: Comment out some lines in a c preprocessor (cpp) file will cause the comment section not to be left-aligned.
Date: Mon, 21 Mar 2022 22:09:16 +0800

I opened the following c preprocessor (cpp) file in Emacs:

;;;;;;;;;;;;;;;;;;;;;;;; begin of test.cpp  ;;;;;;;;;;;;;;;;;;;;;;;;
$ gcc -E ifdef.cxx
# 1 "ifdef.cxx"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "ifdef.cxx"


#if 0
int i = 1;
#else
int i = 2;
#endif
;;;;;;;;;;;;;;;;;;;;;;;; end of test.cpp  ;;;;;;;;;;;;;;;;;;;;;;;;

When I try to comment out the following part in the above file with `M-;`:

;;;;;;;;;;;;;
$ gcc -E ifdef.cxx
# 1 "ifdef.cxx"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "ifdef.cxx"
;;;;;;;;;;;;;

I find the file will be commented into the format as shown in the
attachment. As you can see, comment out some lines in a c preprocessor
(cpp) file will cause the comment section not to be left-aligned. I am
very confused about this behavior of Emacs. Any hints will be
appreciated.

Regards
-- 
Assoc. Prof. Hongsheng Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province

Attachment: image.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]