Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×

Comment Re:Yes if you can afford the time (Score 1) 267

I did say that, yes. I find C's compile-time type safety to be quite good. With the right compiler warnings enabled, it prevents me from accidentally storing a uint64_t into a uint32_t, and from doing stupid things like int64_t x = -10 * y when y is of type int or int32_t. (The correct code is int64_t x = (int64_t)(-10) * (int64_t)y;.) My C compiler is meticulous about catching things like this at compile-time, and I love it.

The only perils I find with C's type system is in void pointers, for example when implementing a comparison routine for qsort — but I really wouldn't call that perilous.

Comment Re:Yes if you can afford the time (Score 5, Insightful) 267

The simple answer is that once you learn how to code it doesn't matter what the language is.

I couldn't disagree with this more. I don't mean to be flippant or argumentative; I simply want to say that my experience has been quite different. I think the langauge you write programs in is incredibly important. You want the right language for the task at hand. Just as an example, I often prototype new ideas for algorithms in Perl as a prelude to rewriting them in C. Perl (and I'm sure Python is as well) is great for a quick prototype and for proof-of-concept testing. But it's terrible for speed (compared to C/C++), and is also terrible at type-safety. When I rewrite something in C, it often runs 100 or 200 times faster than the Perl version. (Not for parsing and string-based stuff, but for integer numerical analysis stuff). But exploring the data structures and getting them worked out first is easier in a high-level language like Perl, with its dynamic arrays, hashes, autovivification, and so forth. Anyway, I rarely prototype something C, and I rarely write production code in Perl. For me, the choice of the language is one of the most important decisions I make on a daily basis.

Comment Re:Interesting since Aspartame spiked Sachirine (Score 1) 630

Stevia is, to me, the best tasting of the non-calorie sweeteners, and I use it in my coffee, and in my homemade grape soda.

I prefer stevia as well. But I find that I only like it in my tea and not in my coffee (although I used to like sugar in my coffee just fine). Out of curiosity, which brand of stevia do you like best? Maybe I need to switch.

Comment Re:History repeating (Score 2) 85

[...] early Apple III computers where heat would cause chips to expand out of their sockets, [...]

“It’s not wise to upset an Apple III.”
“But sir...no one worries about upsetting a Droid.”
“That’s ’cause a Droid don’t cause people’s chips to expand out of their sockets. Apple IIIs have been known to do that.”
“I suggest a new strategy, Artoo. Let the Apple III win.”

Comment Re: Tabs vs Spaces (Score 1) 428

I actually use spaces-only in my own personal code — personally, I hate tabs... BUT — on larger projects where tabs are part of the team culture, the rules listed really do work wonderfully. Everybody can have their own tabstop setting and nobody gets messed up by indentation. I agree that spaces will maintain what you want the code to look like regardless of what settings someone else's editor has, but you can get the same effect by using tabs intelligently. And finally, the example I gave with the for loop actually doesn't break readability at all — it works for tabstop of any size.

Comment Re:Tabs vs Spaces (Score 1) 428

Pretty much. And the issue is that tabs gone wrong is only visible once its viewed by someone with different settings.

Not exactly true. You can pretty easily write a tool that scans a source module for problematic mixing of tabs and spaces. Just require that all changes pass that scan before they are allowed to be checked in.

Comment Re: Tabs vs Spaces (Score 1) 428

Which only matters if all indentation, including alignment, is done with tabs. The moment you throw in a few spaces to line something up on a non-tab boundary (say, to align a second line of arguments with the first argument), then you have a mess, unless your tab width is set to exactly the value that whoever touched the code before you set it to.

What?? Nonsense. Using spaces to line something up on a non-tab boundary is exactly what avoids a mess, not creates it.

To use tabs in code, with zero problems whatsoever, follow these simple rules:

1. Use tabs only for indentation, never for alignment.
2. Tabs may never appear anywhere in the source code except as a contiguous sequence of zero or more tabs at the beginning of a line.
3. Use spaces for alignment, never for indentation.
4. Spaces may follow tabs, but tabs may never follow spaces.

All the lines in your module should match the following regex: /^\t*[^\t]*$/

If you have a for (...) loop that splits across three lines, there should be n tabs leading up to the for, and then on each of the following two lines there should be n tabs followed by 5 spaces, for proper alignment.

Comment Re:Too many pixels = slooooooow (Score 1) 263

Actually, there is no such thing as pure retina resolution. There is only retina resolution as a function of pixel density and viewing distance. So, 4k on a 32" monitor at an 24" viewing distance is retina resolution at typical viewing distance. However, 4k on a 32" monitor at much shorter viewing distance is not.

Slashdot Top Deals

UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. -- Doug Gwyn

Working...