From: Erin S. <ebu...@sq...> - 2003-05-21 17:00:48
|
Jonathan Angliss said: > Hi Guys, > > Spacing: > This one is slightly a readability thing. Keep things consistent. What > I mean by that is if you're using TABs to indent lines... use it all > the way through, although I'd prefer at least 2 or 4 spaces... tabs > aren't too bad, just keep it consistent. 4 spaces is nicer, and on > lines that you are forced to wrap (long IFs for example), indent the > second part to 2 spaces in the if... for example: While spaces technically "use more characters", they are always prone to formatting errors, and differences in user settings. Please use spaces, 4 or 2 - whichever is easier to read, but be consisten= t for the whole block.. If your editor isn't smart enough to use spaces in place of tabs, you may want to get a handy sed script or something that will do it for you, and then check it afterwards. vi, emacs, pico, etc. all have ways to "expand" tabs into spaces.. > automatically use tabs (bleugh). Something I have noticed is some > editors have been putting in DOS/Windows based line breaks. From a > linux editor, those are oddly displayed as ^M and can really mess up > the code. It might be worth looking at editors that can save with unix > line breaks. Editors such as vim, textpad, ultimate-edit or things > like that. I've had a CVS commit completely screw up on me before > because of DOS line breaks. Tool of note: dos2unix (unix2dos) There are many versions of this conversion tool out there, and it does quite a handy job of converting linebreaks from windows to unix. I have noticed that on some implementations, there is a dos2unix and a unix2dos, where in others, dos2unix acts as a linefeed toggle, and will switch back and forth. Check the manpage before using to make sure it doe= s what you want... Erin (ebullient) -- 'Waste of a good apple.' - Samwise Gamgee ICQ: 38670353 |