View Poll Results: Add default colouring to posted code?

Voters
24. You may not vote on this poll
  • Yes!

    18 75.00%
  • No!

    6 25.00%

Thread: Proposal: Code colouring

  1. #16
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    95% of the noobs only post in code tags because we have a script which won't let them post code without them. Even then, there are a few creative idiots who still manage to screw that up.

    On other boards, untagged code is routine, and so is the nagging to get the noobs into line.

    Even when it's tagged, they've obviously either never used indentation, or used some horrid mix of spaces and tabs (see past GD topics) and the code still looks like a mess. "HELLO PEOPLE" the preview button is there for a reason.

    > when you upload a page it will load your defaults so you see it as you wish.
    Excellent - I'll turn it all off thanks.
    At least it won't be me coding that system, and ensuring that through the myriad of choices that everyone sees exactly the same code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  2. #17
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    >> Even when it's tagged, they've obviously either never used indentation, or used some horrid mix of spaces and tabs (see past GD topics) and the code still looks like a mess.

    Well, that's not a problem with the colouring at all, it could be blamed on the tags but mainly the newbs themselves. You can't change how they are going to post their code. They just want answers, nothing more. So perhaps an indentation-beautification treatment with the code tags might be worth implementing, if not the colouring. But then it'll be absolutely necessary to make sure that they don't "do a fine job of actually corrupting the code".

    >> Excellent - I'll turn it all off thanks.
    That's your choice. But I find it easier to 'see' errors in code when the code itself is in colour. I mean the obvious ones, such as people messing up "'s and such. The same goes for the indenting which is one of the reasons why we get so upset with people don't use them. I find it somewhat ironic that you petitioned so hard for code tags, granted it wasn't only for the reasons I've given, but do not wish for code colouring. Only somewhat. I understand they are not the same, don't worry.

    edit:
    >> Great idea, but I'll take 95%, thanks.
    I reported some bugs to you, so with inflation, exchange rates, political tensions ... mumbles ... I'll have 23%
    Last edited by twomers; 04-14-2007 at 07:04 AM.

  3. #18
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Code coloring and some sort of auto-indention would be great. I don't want to get picky about the proper way to beautify code, but at least if some standard was used here, it would be easier to see what the clueless people are doing or not doing.

  4. #19
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Given the format of other tags, like [quote], I think if this feature was enabled it might have this syntax:
    Code:
    [code]
    or
    [code=language]
    or
    [code=language;style] (maybe)
    I agree that if this were enabled there would probably be arguments about which style was better. Perhaps it could be colour coded and the viewer could choose the style, in their User Profile or something?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #20
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Another blow for PHP code tags: In IE 6, when you have a PHP code block selected (i.e., you click on it) you can't scroll with the keyboard: up, down, page up, page down, nothing works. You can of course just click off to the side. But it annoys me at least . . .

    (Yes I know that IE 6 is not the best browser in the world . . . this is not my computer.)
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #21
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    One thing I was wondering was how come the php script-colour-er is enabled. Not so much 'why is it enabled', I know it's in a good few programming forums, but why is it so common around the place? Is it just ... there or something?


    >> Perhaps it could be colour coded and the viewer could choose the style, in their User Profile or something?
    Yeah, that's what I suggested. Could be defaulted to nothing and you change it, or something.

  7. #22
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    One thing I was wondering was how come the php script-colour-er is enabled. Not so much 'why is it enabled', I know it's in a good few programming forums, but why is it so common around the place? Is it just ... there or something?
    A vBulletin (and other forum software) default?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #23
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    One thing I was wondering was how come the php script-colour-er is enabled. Not so much 'why is it enabled', I know it's in a good few programming forums, but why is it so common around the place? Is it just ... there or something?
    PHP can highlight itself. It's built in to the language. So any board written in PHP usually supports highlighting PHP.

    >> Perhaps it could be colour coded and the viewer could choose the style, in their User Profile or something?
    Yeah, that's what I suggested. Could be defaulted to nothing and you change it, or something.
    Now that's an idea!

    But I think that you should still need to mark code that is to be coloured, because having all code coloured would be annoying (see my first post).
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  9. #24
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Elseweb, on sites that have introduced it, at first it seemed nice to me. But it's always someone else's scheme, so as the novelty wears off it ends up looking to me as unappealing as the PHP code coloring.

    I think it would be interesting to be able to post with some magic tags that present code in the same manner as my editor. But then again, as Salem mentioned, plain Jane code tags display the bad formatting that is the issue often in newb-presented code. And as has also been mentioned, I am also one who likes to take "plain" code tags and use my own coloring to highlight certain parts of the code.

    So by default, the enforced code tag script is best for newbs and passersby. If a special colorizer were available, I would be unlikely to use it. I've even stopped using the minimal one I started to write long ago. (Once in a while, however.)

    I understand the sentiment, but I think you may also arrive at the "keep the status quo" point of view after you've come full circle.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  10. #25
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I think my/twomers' idea is a good one: you put
    Code:
    [code=c++][/code]
    and each member gets to choose how coloured C++ code is displayed. Perhaps they could choose Dev-C++ style, or Kate style, or no style (disabled altogether).
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  11. #26
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    But then if they had Kate colouring for example, and the author had highlighted a few specific lines... oh noes

  12. #27
    Math wizard
    Join Date
    Dec 2006
    Location
    USA
    Posts
    582
    I voted yes, as highlighting code, especially if more than 20 or so lines, can make things easier to pick out. Fundamental C syntax things like "if", "while", "sizeof", "long", or "unsigned" would be one color. Common C functions like "printf", "scanf", "malloc", "fopen", etc. would be another, strings as another, and everything else as fourth.

    This image gives a decent overview of some of it - blue is for C's fundamental key words, white for basic syntax, teal for user functions, red for variables, yellow for structs, magenta for numbers, and green for comments.
    High elevation is the best elevation. The higher, the better the view!
    My computer: XP Pro SP3, 3.4 GHz i7-2600K CPU (OC'd to 4 GHz), 4 GB DDR3 RAM, X-Fi Platinum sound, GeForce 460, 1920x1440 resolution, 1250 GB HDD space, Visual C++ 2008 Express

  13. #28
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    Quote Originally Posted by zacs7 View Post
    But then if they had Kate colouring for example, and the author had highlighted a few specific lines... oh noes
    Why do you keep bumping old threads?

  14. #29
    Math wizard
    Join Date
    Dec 2006
    Location
    USA
    Posts
    582
    Wow! I didn't notice that this thread was a month old! I still support the idea though.
    High elevation is the best elevation. The higher, the better the view!
    My computer: XP Pro SP3, 3.4 GHz i7-2600K CPU (OC'd to 4 GHz), 4 GB DDR3 RAM, X-Fi Platinum sound, GeForce 460, 1920x1440 resolution, 1250 GB HDD space, Visual C++ 2008 Express

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 05:39 PM
  4. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM