What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 127 Stack Exchange communities.

Suppose there's a piece of code that's just one line long, as the following one.

printf("Hello World!\n");

Does it make it clearer (more readable) if code tags are used (like above) or is that just plain overkill? So, in other words, which is clearer? Is it better the above, or the following?

printf("Hello World!\n");

My own thoughts are that code tags should always be used when code is written—regardless of the length of code—and even if it's a single line. Further, I think it makes things more readable if even a single word that's code-related—like myfunc()—is enclosed using code tags. However, I wonder if this is going overboard, and I am interested in knowing what others have to say.

share|improve this question
4  
first one is cleaner and code block make it more readable –  NullPoiиteя Dec 26 '12 at 5:15
    
Thank you for your input. –  aLearner Dec 26 '12 at 5:53
add comment

1 Answer

up vote 8 down vote accepted

Code tags should always be used for any code in the post. It makes it cleaner and more readable. IMO it should also be used in the text for indicating a class name or some object. For example.

I am having problem with SqlBulkCopy usage with the SqlTransaction, following is the sample code....

share|improve this answer
3  
Don't forget that using normal code blocks (by indenting four spaces) causes code highlighting to take effect - improving readability. –  jadarnel27 Dec 26 '12 at 5:21
    
Right. This is a great point. Thanks for sharing! –  aLearner Dec 26 '12 at 5:26
add comment

You must log in to answer this question.

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