I've recently noticed a disturbing behavior of the code formatting shortcut (Ctrl + K) that seems to be completely invalid. It appears that applying Ctrl + K resulted in content change (which was correct logically, but completely defaced the question being asked). Here is the question on SO: Heap corruption using calloc . Initially I assumed the edit in revision 3 was incorrect and rolled it back. Later I edited myself by applying Ctrl + K and got the same result and had to change it back manually to the original code.


1 Answer 1


That's not the indentation by CTRL-K doing that. It's part of the * asterisks in the code being interpreted as italics when the code is not indented.

When looking at a strange change in a post, always look at both methods of displaying the difference; if you look at the change in markdown only spaces have been added.

The code really does use float ** and sizeof(float*) but that wasn't visibile before adding proper indentation: PermLaster= (float **) calloc(AntPermLast, sizeof(float*));; the value between the second * and the last * in the line was italicised instead.

The code formatting is working entirely correctly here, your edits were wrong. By indenting the code properly it is being displayed as code instead of having it being interpreted as markdown-formatted text. That is why I rolled back your edit.

  • In this case the result of Ctrl+K should've been (float ***), isn't it so? Dec 7, 2012 at 8:36
  • BTW, why have you rolled back to rev. 4? Rev. 5 is better Dec 7, 2012 at 8:37
  • 2
    @icepack: because you altered the original code, which was only being displayed wrong, not logically wrong. Dec 7, 2012 at 8:38
  • @icepack: No, please look at the markdown source and do not change the code when editing that post. Dec 7, 2012 at 8:39
  • I see now. This is extremely confusing. Actually, we don't know what original content was intended by OP. Dec 7, 2012 at 8:44
  • 4
    @icepack: We do, by looking at the revisions. You could also ask the OP by leaving a comment. Dec 7, 2012 at 8:45
  • 1
    @MarijnPieters I don't see how revisions would help here. The OP may have had the same confusion as me (and it's very likely given him being new). Dec 7, 2012 at 8:49
  • I'm accepting this answer since it contains the technical explanation for the behavior. But there is something very wrong with the markdown rules, IMHO. Dec 7, 2012 at 8:52
  • 4
    @icepack: Then don't change the code but leave a comment asking for clarification. Dec 7, 2012 at 8:53
  • 1
    @icepack: What is wrong with the markdown rules? If you want to display code and not have it interpreted as having further markup you indent it. If it is not indented then two * asterisks make text italic. Using _ underscores has the same effect. Dec 7, 2012 at 9:03
  • In an ideal world we wouldn't have to do tons of formatting edits to posts. Unfortunately, we aren't in an ideal world. I would expect that in case of possible side-effects (such as when combining italics with C pointers) the engine would at least present a warning to the writer with an option to reconsider or choose between 2 possible logical results. Dec 7, 2012 at 9:07
  • 1
    @icepack: That way lies madness. In python underscores are common, and I am sure there are plenty of other languages that use similar symbols in their syntax. Should Stack Overflow have to know about each and every different programming language? What about the Maths Stack Exchange site? The Tex site? This gets complex really fast. Dec 7, 2012 at 9:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .