Possible Duplicate:
Why are there no line numbers in the code listings?

I want to display C++ code prepended with line numbers on Stack Overflow. The indented C++ code is formatted with Stack Overflow's built-in <!-- language: cpp --> tag.

I need this because gdb (gcc debugger on Linux) outputs the error for a certain line number in a C++ source file and the C++ code is quite long.

So I was just wondering, is it possible to display line numbers for C++ code posted and formatted on Stack Overflow?

  • 3
    If this were implemented, it would have to include a capability to copy the code without the line numbers. Otherwise, it's a non-starter.
    – user102937
    Commented Jun 24, 2012 at 0:57
  • You are right. The coders who will read the post shouldn't have any difficulties reading the posting too. I agree with the policy made by stackoverflow. So the coding should be as minimum as one could. I saw this line numbering on other websites and copying is very cumbersome. At first I was wanting this feature for temporary convenience. But stackoverflow is right about this.
    – user189072
    Commented Jun 24, 2012 at 1:08

1 Answer 1


Extremely sorry I didn't search properly before posting.

I found the answer here:

Why are there no line numbers in the code listings?

Line numbers in code

So it is better not to have line numbers. I agree 100% with stackoverflow's policy.

Thanks stackoverflow.com for doing a superb job.