• Forum
  • Lounge
  • Should there be a sticky about code tags

 
Should there be a sticky about code tags?

I've noticed a lot of people are posting code without using code tags! Not that it bothers me too much, if I can't be bothered reading it, I'll just ignore it but having to tell someone every day to use code tags does grate a little.

I looked through the "Welcome" sticky on the Beginners board: http://www.cplusplus.com/forum/beginner/1/ and although it's quite a comprehensive guide to forum etiquette there is no mention of code tags.

Not that I believe all the new guys read it before posting, but I was thinking shouldn't it be amended?

How many times a week do you ask new forum users to use code tags? And how many of those people actually listen to you?
How about a warning about code tags right on the new thread page? I guess it might be annoying, but it would be useful.
Actually I like the warning idea best. People can blatantly ignore stickies. Most if not all newbies don't even open the threads. But a warning in the programming forums would force them to at least see it once.
Xander314 wrote:
How about a warning about code tags right on the new thread page?
That would save us all some trouble!
No it wouldn't.

Over at DaniWeb they have a very aggressive approach to encourage people to use code tags. I can't tell any difference between the percentage of posters who fail to use them and those who do between the two forums.

Remember the second rule of UI design: "Users don't read anything."
How about an unclosable popup?

Relax, this was a joke
How about something that scans the post looking for something that is unmistakingly C++ code, and makes sure it is in code tags?

No need to make it too complicated, maybe just look for braces. Also, since people "get it" after they've been here a bit, no need to do it for everyone. Just do it if their post count is low.

- user submits post
- if user's post count >= 20, post as normal
- otherwise, scan post. Look for "{"
- if not found, post as normal
- otherwise, scan post. Look for "[code]"
- if found, post as normal
- otherwise redirect user to a error page that gives a simplistic example of how to use code tags.


Excessive? Yes.
Worthwhile? Probably not.

Just throwing it out there for giggles.
That's actually how they do it on some forums... Over at the Tcler's Wiki, anything that has leading whitespace is considered code.
closed account (1yR4jE8b)
Leading spaces is an excellent idea, and would be effortless to implement.
Except that many newbies actually do program like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<iostream>

   using namespace std;

int main (){

char yn;



      while ((yn == 'Y') || (yn == 'y')){
cout << "Hello there, handsome!\n";

            cout << "Would u like to hear it again?";
                 cin>>yn;
}

    return 0;
}

Maybe a second text box marked with bold, red, blinking letters "YOUR CODE GOES HERE, MORON"?
I think the MSDN forums have a special pop up box for code, but it still requires you to click a button...
Remember the second rule of UI design: "Users don't read anything." It doesn't matter how annoying or obvious you make it.
A thing that could be done is not removing excess whitespaces. I never understood why that could be a good idea.

#include<iostream>
using namespace std;

int main (){
char yn;
while ((yn == 'Y') || (yn == 'y')){
cout << "Hello there, handsome!\n";
cout << "Would u like to hear it again?";
cin>>yn;
}
return 0;
}

is definitely less readable than

#include<iostream>
using namespace std;

int main (){
    char yn;
    while ((yn == 'Y') || (yn == 'y')){
        cout << "Hello there, handsome!\n";
        cout << "Would u like to hear it again?";
        cin>>yn;
    }
    return 0;
}

and I think that a fair amount of newbies do have their code formatted to some degree.
Though of course, code detection would be awesome.
Last edited on
Just say that everything is code, and wrap the text.
If people post like http://www.cplusplus.com/forum/lounge/48476/#msg263358 then the tags are useless. However if they provide automatic indentation...
Requirements churn...
The only solution I could see could be viewed as extremely intrusive, which would be to give the more "trusted" users a power to add certain tags to new users' posts (code, output, maybe quote).

As I said, though. It's a little bit too intrusive for my taste.

-Albatross
I agree with hamsterman. Whitespace is useful. However, my pretty variable-width, non-serifed font doesn't have the same whitespace characteristics as a fixed-width font.
1
2
3
4
code tags are pretty useful because it makes stuff so easy to read
that way people will actually want to help you with your work
naw'msayyeennn?
ps what's wrong with this it makes my computer look so funny?

#include<oistreem>
void mane( )
{for(;;){
printf("goodbye, cruel world!);"
}
 
the error I get says: Compiler Error Message: CS1337 Line 1: give up

Topic archived. No new replies allowed.