the code tag is rubbish. code by its very nature is long and often wide. the code tag puts the code in a box which is neither.
And your point is…?
That the code tag is rubbish. It’s right there in the OP.
No, I mean what’s your point in posting so? You want them to change it? Get rid of it? For people to stop using it? Or what?
Well I just wanted to express the opinion that it is rubbish.
But since you ask. I’d want a way to make it fit the code you’re pasting into it. Otherwise it would actually be better to post your code directly into your post, and maybe set it all italic to distinguish it from the rest of the post.
The point is not fit, but formatting. The code tag preserves whitespace, which would otherwise be lost rendering the code much more difficult to read. Also, it’s primarily intended for PHP, and it color codes PHP keywords, directives and operators; PHP is not a very verbose language and doesn’t need long lines, usually.
I didn’t expect anyone to come in and take me seriously (this is ATMB where people post threads called ‘Toast’ with single line ops) but I’ll humour you.
There’s a php code tag and a generic code tag. I’m talking about the generic one.
<?php
echo "hello world";
?>
<%
response.write "hello world"
%>
<%
response.write "<table><tr><th>a header</th><th>a header</th><th>a header</th><th>a header</th><th>a header</th><th>a header</th><th>a header</th><th>a header</th><th>a header</th><th>a header</th></tr></table>
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
code
Ok, well, then the whitespace thing.
do you mean the preservation of indentation?
edit, one other annoying thing about it, and also about the edit box for typing out your post is - if you use your mousewheel to scroll to down it, when it gets to the bottom the mousewheel switches to scrolling the outer page - thus throwing your edit box off the screen.
May I recommend using a nightstick, officer.
All whitespace, not just indenting. It’s great for posting ASCII art.
With code tags:
________________. ___ .______
/ | / \ | _ \
| (-----| |----`/ ^ \ | |_) |
\ \ | | / /_\ \ | /
.-----) | | | / _____ \ | |\ \-------.
|________/ |__| /__/ \__\| _| `.________|
____ __ ____ ___ .______ ________.
\ \ / \ / / / \ | _ \ / |
\ \/ \/ / / ^ \ | |_) || (-----`
\ / / /_\ \ | / \ \
\ /\ / / _____ \ | |\ \---) |
\__/ \__/ /__/ \__\|__| `._______/
Without code tags:
________________. ___ .______
/ | / \ | _ \
| (-----| |----`/ ^ \ | |_) |
\ \ | | / /_\ \ | /
.-----) | | | / _____ \ | |\ \-------.
|________/ |__| /__/ \__\| _| `.________|
____ __ ____ ___ .______ ________.
\ \ / \ / / / \ | _ \ / |
\ \/ \/ / / ^ \ | |_) || (-----`
\ / / /_\ \ | / \ \
\ /\ / / _____ \ | |\ \---) |
\__/ \__/ /__/ \__\|__| `._______/
Not good code.
Good code is between columns 7 and 72, like God & Grace ordained.
(And it includes Capital Letters, too, just like English. You should get someone to teach you about using them.)
i know how to use capital letters.
god doesn’t exist.
i’ll grant you good code isn’t wide. good code contains capital letters. quick code (which one is not paid for) is long, lazy, and may not contain capital letters.
may not have comments either or wel speld wurds innit.
COBOL is for weenies who can’t handle a real programming language.
This is what I came to say. Except each of two monitors supports 120 characters, and I use emacs in split-screen dual monitor mode, so I could wrap at 240, but that would just be terrible In practice I have M-q wrap at 72.
Good code includes comments. The most useful comments are generally written to the side of the code, extending its width.
I’d certainly like to see the code box extended to the same width as the quote box, if Jerry (?) can swing it.
I never write comments to the side of my code, and the comments are never longer than 72 characters. I write comments above the code if it describes it, and below it if the comment is a representation of data or something similar after that line has executed.
I strongly disagree.
Comments written on the same line as the code are generally useless minutia, needlessly echoing the code. Example:
total = x + y /* add x and y to get the total.
Such comments usually tell what the code is doing; useless, since you can see that from the code itself.
Useful comments are at the beginning of the block, and explain the function of this block, telling why it is being done, which you can not see from the code.
I know that’s the intent, but I’ve never seen it actually work. People feel like you should be able to understand what a few hundred lines are doing because they put a “this is what I’m gonna do” at the top. Unfortunately, that doesn’t really help. I can usually tell what the purpose of the function is just by the name of the function. Adding a comment that states that in more words is rather pointless. Actually stepping through it and saying what the process is as they go through is actually useful to fixing and editing the code.
(And if they use variable names like x and y they deserve to be slapped.)
Yes, that’s very good. Now, just step back, please.