Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 153 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

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.

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
In this case the result of Ctrl+K should've been (float ***), isn't it so? – SomeWittyUsername Dec 7 '12 at 8:36
BTW, why have you rolled back to rev. 4? Rev. 5 is better – SomeWittyUsername Dec 7 '12 at 8:37
@icepack: because you altered the original code, which was only being displayed wrong, not logically wrong. – Martijn Pieters Dec 7 '12 at 8:38
@icepack: No, please look at the markdown source and do not change the code when editing that post. – Martijn Pieters Dec 7 '12 at 8:39
I see now. This is extremely confusing. Actually, we don't know what original content was intended by OP. – SomeWittyUsername Dec 7 '12 at 8:44
@icepack: We do, by looking at the revisions. You could also ask the OP by leaving a comment. – Martijn Pieters Dec 7 '12 at 8:45
@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). – SomeWittyUsername Dec 7 '12 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. – SomeWittyUsername Dec 7 '12 at 8:52
@icepack: Then don't change the code but leave a comment asking for clarification. – Martijn Pieters Dec 7 '12 at 8:53
@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. – Martijn Pieters Dec 7 '12 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. – SomeWittyUsername Dec 7 '12 at 9:07
@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. – Martijn Pieters Dec 7 '12 at 9:13

You must log in to answer this question.

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