yangchang's blog

By yangchang, history, 10 months ago, In English

When I try to compile such a programme:

	#error //there is a tab before "#error"

G++ will report an error:

a.cpp:1:10: error: #error
    1 | #error
      | ^~~~~

However, I'm using tab indentation, which I think is G++ converting tabs to 8 spaces!

that is my G++ version:

g++ (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r4) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I tried previous versions of G++, at least on 10.*. * version, it is positioned correctly.

I need G++ to position it correctly, how do I fix it?

Please don't suggest I use space indentation

  • Vote: I like it
  • +16
  • Vote: I do not like it

»
10 months ago, # |
  Vote: I like it -10 Vote: I do not like it

use space indentation, if u don't wanna, go to ur editor settting(even vim has it), and change tab to be configured as 2 spaces