Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×

Comment Re:= in an if statement should end in warning/erro (Score 1) 360

I use it all the time in code like:

if(( bytesWritten = write(sock, buf, bytesRemaining)) == ERROR) {

It's an ok to deal with the fact that the BSD socket API is overly verbose and a pain to deal with. The last time I made a mistake accidentally doing = instead of == was a long, long time ago, though. So I'm not sure it's a real problem.

Comment Re:Type safety (Score 1) 360

But even in C, it should (and does using any reasonable compiler, I think) generate a warning.

Personally, I try to code any comparisons involving literals with the literal on the left (e.g. if(0 == foo)... instead of if(foo == 0)...) so that I get a "lvalue required as left operand of assignment" error if I leave one of the equals signs out. And when I intend an assignment, I do it in a separate statement (e.g. foo = 0; if(0 == foo)...).

On a side note, the compiler folks probably ought to change that error message to "hey idiot, you're doing an assignment when you really mean to do a compare" since that's more likely to be the cause rather than that you intended to assign but just forgot that your identifier wasn't a valid lvalue.

Comment Re:Crime (Score 1) 318

Open prison as described by the Wikipedia article sounds like the opposite of what the great-grandparent AC claimed. In his post, he said that the prisoners were let out for the weekend to do whatever they want, whereas the Wikipedia article says that prisoners are let out to work [most likely, during the week] but spend their free time in the prison. The latter seems much more reasonable to me.

Comment Re:Crime (Score 0) 318

Senators don't get to sentence people in the USA. We have judges for that.

Would these be the same Senators and judges who are failing to do anything about all the other unconstitutional stuff the Federal government is doing? If so, surely you can see why Assange -- and the rest of the non-idiots in the US and the world -- would be skeptical of your argument.

Comment Re:What exactly is the point of the furlough anymo (Score 1) 1144

Yes general wear out is covered by some policies. Just like the definition of motor burn-out is very wide and can be applied to a 50 year old fridge if you want. It all depends on your insurance.

Here in the US we call that kind of thing a "maintenance agreement" which is usually separate from "insurance" and typically expensive enough that a substantial fraction of people (especially the smarter ones who have savings) don't bother to get it.

Yes I have car insurance that covers every type of external liability.

When I asked "but what about some other kind of general liability?" I was talking about non-driving-related liability. Like -- I don't know -- if you were walking around somewhere (like a shop or a friend's house) and tripped and broke something expensive. Obviously, your car insurance wouldn't cover that.

The general point I was trying to make is that surely there's some circumstance in the infinite universe of possibilities where something could happen to you that would cost you money to fix, but would not be covered by any of the various insurances you have. And that that's what you'd need an emergency fund for.

You seem to have a disconnect between the entire discussion. If I needed an extra $50 I would likely skip a trip to the movies or something similar. Most families that live paycheck to paycheck to do comfortably and temporal discomfort is something that is quite easily absorbed. That's the kind of average families we're talking about.

No, it's not -- in fact, maybe that's the whole problem here. In the US, "living paycheck to paycheck" means that by the time you get done paying rent, utilities, commuting costs (gas or bus fare, etc.) and the bare minimum groceries you are done and have no money left over. Having $50 to spend on the movies means that you are not "living paycheck to paycheck" but rather that you have $50 left over as discretionary funds, which you choose to spend on the movies.* "Living paycheck to paycheck" means, by definition that you cannot easily absorb any unexpected expense. For the kind of households I'm talking about, getting a flat tire means they have to choose between having the lights on or eating (or paying on credit and starting a downward spiral to bankruptcy and homelessness).

(* Technically, it can also mean you do have $50 to spend on the movies -- or cable TV, or eating out, or whatever -- but consider it a mandatory expense in the same priority as rent because you're an idiot. I mention this because it's way more common than you might think.)

Comment Re:quicksort better than OOP? (Score 1) 598

And not at all like OOP as it is generally understood by Java, C#, and C++ programmers. Again, no one can even agree on what constitutes OOP. It's an incoherent concept at best. Dig up a few definitions. You'll find most are vague, many are inconsistent, and a few so broad that they're meaningless.

Really, OOP is having the data combined with the functions that operate on the data. Everything else involved in OOP derives from that.

"OOP is an exceptionally bad idea which could only have originated in California" — Edsger Dijkstra

Bertrand Meyer digs deeply into the Liskov style of OOP in his book Object Oriented Software Construction, and concludes that invariants and proofs are one of the most important concepts that can be learned from the Object Oriented Method. So much so that he created a language based around that idea (Eiffel, where each method and class can have a formal contract). The end result looks a lot like what Dijkstra himself wrote about in A Method of Programming.

In other words, digging deeply into OOP, which Dijkstra despised, leads directly to programming by proof, which Dijkstra loved (maybe too much).

Comment Re:JIT Education (Score 0) 745

Well said, that is truth well written

Aside from the obvious that workers are not slaves (you have freedom to leave etc), thinking of yourself as a slave is a poisonous attitude to have that will hurt you. Perhaps the best way to explain it is with this quote that illustrates the same point differently, "the most dangerous financial mistake a person can make is to think they are working for someone else." If you're thinking of yourself as a slave, you are thinking of yourself as working for someone else. Your current job can be a stepping stone for you to move your career to where you want to be, to reach your goals in life. Even if you're just working as a janitor, you can still use it to your advantage. Think Harrison Ford working as a carpenter on movie sets putting him in the right situation to get a movie role.

If you think of yourself as a slave, it will make you miserable at work. A better attitude is to think, "I am providing something of value to the company in exchange for something of value in return." That attitude makes you feel more free, because if they stop providing sufficient value, you will know when to leave. It gives you power to ignore TPS reports because you know that's not the value you provide. You will feel so much happier at work if you look at it that way. (The Tao of Programming has some good reading to this point in chapter 7, I strongly suggest checking it out).

And maybe as the main point, some jobs just treat you like a slave, yelling at you, trying to get you to work every weekend, etc. Or maybe you just don't like your career, like the guy in Office Space. Don't let people yell at you. That's the case where you should get another job, or even career. Personally, I like programming, and I enjoy a lot of the challenges at work, so I will stay in this career. But I've found a company that is more interested in getting the job done than in how many hours I work. So I work 30 hours a week. Find something you like, don't put up with slave-driver jobs.

Slashdot Top Deals

2.4 statute miles of surgical tubing at Yale U. = 1 I.V.League

Working...