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

 



Forgot your password?
typodupeerror
×

Comment Re:The Compiler Knows... (Score 2) 102

returning anything other than an iterator from cbegin() is a gigantic misdesign

That's precisely the point, now isn't it...

You are begging the question; you are assuming the contract; you are programming by [implicit] convention—that which plagues dynamic typing.

That is to say, such informal programming tends to be practical in these cases, but don't confuse that practicality with correctness.

Comment The Compiler Knows... (Score 0) 102

auto... the compiler knows the type of MemVec.cbegin() so why should I need to repeat it?

You're not repeating it; rather, you're specifying it.

Specifying the type is establishing a contract for the following code. This can be very worthwhile.

Note how the scope of cit is now limited to its area of use.

Of course, you could have achieved the same by declaring the variable inside the for-loop; keep things looking simple via a local typedef outside the for-loop:

typedef std::vector::const_iterator CIT;
for (CIT cit = MemVec.cbegin(); cit != v.end(); ++cit) {
        if (LookForPatterm(*cit))
                return true;
}
return false;

Comment Re:NASA Proposes "Water World" Theory For Origin o (Score 5, Interesting) 115

Carl Sagan, in Cosmos:

If the general picture, however, of a Big Bang followed by an expanding universe is correct, what happened before that? Was the universe devoid of all matter, and then the matter suddenly, somehow created? How did that happen?

In many cultures, the customary answer is that a "god" or "gods" created the universe out of nothing. But, if we wish to pursue this question courageously, we must of course ask the next question: Where did God come from?

If we decide that this is an unanswerable question, then why not save a step, and conclude that the origin of the universe is an unanswerable question? Or, if we say that God always existed, why not save a step and conclude that the universe always existed? There's no need for a creation—it was always here.

These are not easy questions; cosmology brings us face to face with the deepest mysteries, with the questions that were once treated only in religion and myth.

Comment Re:It's alive (Score 5, Interesting) 115

inanimate matter

What does ‘inanimate’ mean? The problem is that people are always making this bizarre differentiation between ‘animate’ and ‘inanimate’, when really there is just matter interacting with matter; some sets of interactions are more complex and organized (or, shall we say, repetitive and sustained) than other sets of interactions. Indeed, sometimes that complexity and organization is so great that we call it ‘life’ and even ‘intelligent life’, but it’s all one and the same:

Matter interacting with matter.

When you eat some metal such as calcium, that calcium may become incorporated in your bones. Is that calcium all of a sudden ‘animated’ and ‘living’? Is the water that you drink somehow ‘animated’ because it flows through your brain cells?

A child is a continuation of that complex interaction between matter that we call the parent.

Slashdot Top Deals

FORTRAN is not a flower but a weed -- it is hardy, occasionally blooms, and grows in every computer. -- A.J. Perlis

Working...