I almost never comment my code, mostly because I'm the only person that ever looks at it. And I use D3D, because SADX does, and I'm not even sure if OpenGL has managed libraries (lol .NET).
Same. Some C, C++, and C# experience, though. Of the three, C# is my favorite, probably in part due to being very similar to Java, but also because I learned it with XNA, which I thought was pretty nice. As for commenting / formatting, I usually put // comments on their own lines, just because I usually have the window at less than maximum width, so putting a comment after a long line would make it hard to be seen. I'm a stickler for headers; if one of my students (while I was a TA) didn't put their name or some other identification as a comment, I'd take points off. For braces, I use separate line notation, unless it's, say, an empty block, or something really simple already inside a block: Code (Text): finally { try { if (stmt != null) stmt.close();} catch (SQLException e) { handleSQLException(e);} }
Well... I know a lot of languages to code in: HTML, JS, PHP, CSS, Fortan, Pascal, ActionScript, C, C++, Java, Objective C, x86 ASM, M68k ASM, Ada, Perl, Python, and a lil bit of BASIC. Most commonly I'm doing ObjC for this magical Mac App I'm working on, PHP for the server-side shit, and sometimes I stick a bit of x86 ASM in my code. As for commenting - I never comment my code at all. Until I run into a problem and comment the living shit out of it. In that case, a file turns into 99% comments. Thank god I don't have to code on stuff together with people.
In the process of learning Lua for MTA, and possibly Garry's Mod. Though, I might just learn it all together.
I know: 68k ASM VB6 Nintendo's NS-HUBASIC (or G-BASIC in "famiclones") Lua (Gens Movie Test's) [still learning...]
I never do. I see it as adding a needless line - you're already starting the function with the name and etc, and considering the curly brace is a single character, why should it have its own line? The start of the function is clear enough as it is.
I don't mind extra lines. I personally think it looks better with braces on their own lines. Only time I don't do it is when I make the constructors/destructor in a class. I'm also pretty damn obsessed on my coding structure. Like, insanely. I will go through all of my code to make sure I keep white space up to my standards. I keep berating my group members (we're making a pinball game for our final assignment in class) to keep to my coding style (because it's my engine they're working with) and they're all like "dude wtf who cares". >:{ I'll go in and make it all uniform later. Yes, it bothers me that much. >_>
I usually do the code on the sides if I'm just saying "this does that" but if I'm actually putting something longer than a little phrase I put it at the top. Also, I hardly ever comment until way after writing something when I get around to releasing, and even then, my comments are pretty minimal. I don't idiotproof stuff :P
You all suck, bask in the wonders of AviSynth and think about all you have done wrong. ...so what, it's the only language I actually 'know'. :v:
A lot of the "odd" styles you see were done back when people were scrounging for every last byte. It's the same reason people still use hard tabs instead of spaces. Spaces mean your indentation is the same on EVERY last editor - hard tabs may be god only knows what. So I go with all spaces and everything on it's own line. It uses more space, but who gives a flip! Yeah, I'm really concerned about that one extra line filling my 1 TB harddrive.
I know the most diverse language would be C++ but personally, using C# or Java is the most comfortable language for me. For websites, definitely ASP.NET/C# if you want to build websites quickly and have no knowledge of PHP. I've totally gone off scripting since my Perl days.
Sadly both Quick Basic and Visual Basic insert a series of spaces even if you press TAB, I'd totally prefer to use a hard TAB instead Fortunately when I write stuff in php I can use hard tabs since I use notepad :v: Then again I rarely indent my code at all, so this doesn't really matter. I just see spaces as a waste, and I think they can easily lead to misaligned code if you accidentally remove one of them and have (e.g.) 4 spaces here and 5 spaces there. With a tab it's just a tab.
The worst issues with hard tabs arise when they're mixed with spaces though - and a lot of projects do that. Ack, reading code when its indentation seems random is annoying.
I'm also pretty pedantic when it comes to coding style. My coding style has changed over time: it went from 4 spaces to 2 spaces to 1 space to 4 spaces (never tabs, except for ASM). For C, C++ and C#, I put the braces on individual lines (because Visual Studio and StyleCop seem to prefer it that way), but when I do Java, it looks like Eclipse prefers that I use fewer lines. But now I'm using Qt Creator for other projects and it does like Eclipse... WHAT DO I DO NOW?? (Oh wait, it's configurable. Yay for options.) Also, it likes to put case labels at the same level as the switch, whereas I prefer indenting the case: Code (Text): switch (n) { case 0: puts("It's zero."); break; case 1: puts("It's one."); break; default: puts("It's neither zero nor one."); break; } I configured Notepad++ to show symbols for whitespace because I'm so pedantic about it. :v: And unlike some other editors who use the color of the text for the symbols, it's possible to change the color in Notepad++ so that it isn't too "noisy" (although the default color is fine).
Pretty much this; I always format my code like this, simply because I'm anal. Every block of code gets its own indentation layer, invariably.
Actually, no. Tabs are a LOT more convenient and portable than spaces. Here's why. Consider you like indentation of four (4) spaces, so you indent your code with 4 real spaces. Now, your co-worker, who is also working on your code, likes indentation of 2 spaces only. So, to make the code more pleasant to his eyes, he would either have to manually remove those extra two spaces of indentation or run a formatter/indention tool. Tedious. Now, if you used tabs, all he/she would have to do is to just set the tabwidth to the amount of spaces you like. Simple, easy and portable. No manual stuff required. Using tabs, you're not only pleasing yourself, but others as well. Using spaces, you're only pleasing yourself. (All this considering that you aren't using a brain-dead retarded of an editor).
I indent my code exactly like this, except when, as in this situation, each case has only one command attached to it, in which case I put it on the same line as the case. And hard tabs all the way. Except HTML, where I like to use spaces because I like to keep indents very small there. Oh, and I always indent, as it's an old habit left over from QuickBASIC/GW-BASIC/Python.