Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×

Comment Re: What a confusing summary! (Score 1) 128

The test says that the class with private members and no setters is intended to be immutable after creation, so that's not a problem. Having a single linked list for the entire grid (rather than a list of lists) is completely insane though. I'd expect a student who actually knew what he or she was doing to be more confused than one that would end up writing code with horrible algorithmic complexity. Looking at the rest of the test, it's not much better. If this is what AP tests look like in the USA, then I'll make sure not to weight it very highly when looking at applicants next academic year.

Comment Re: Colorado sure has nice beaches (Score 1) 940

If they were being pushed out of land they owned, you might have a point.

The problem is when the initial conditions are concentrated ownership. If the hypothetical impoverished country has a feudal system (or similar) where all of the land is owned by a few dozen lords. Now the Americans going over there buy land from the lord in relatively small parcels, allowing him to turn his wealth into liquid form and removing the land that his serfs lived on. So what do the serfs do? They didn't own the land and they're now displaced. They weren't lucky enough to be born owning land so they get nothing.

It's not like most of the people in the original poster's example chose not to own a house. They rent because they didn't inherit enough wealth to own somewhere to live.

Comment Re:Given how C++ is taught. (Score 1) 345

Not true. In C++11 you have std::make_shared, which allocates an object and the metadata block for a std::shared_ptr in a single block, giving you a lower-overhead mechanism for creating a std::shared_ptr. C++14 also introduced std::make_unique, which doesn't save anything over calling new and then casting to a std::unique_ptr, but make it possible to write code without any need to directly call new. In C++14, there is absolutely no reason to see a new or delete in the code outside of the standard library implementation. If you're writing one then you're doing it wrong.

Comment Re:Given how C++ is taught. (Score 3, Insightful) 345

"Smart pointers" are great -- if you don't care about performance (in which case, why are you not using Java?). If the object is owned by one thread, it's just sloppy to put in the overhead of smart pointers to make your life easy.

If an object has a single unique owner, then std::unique_ptr has no run-time overhead and will ensure that the object is correctly deleted even in the presence of exceptions. I agree with the grandparent: any object that isn't allocated on the stack should be created with std::make_shared or std::make_unique.

Comment Re:Knowing when not to (Score 4, Insightful) 345

making the code run faster qualifies if it's not running fast enough yet

And then only if backed up by realistic macrobenchmarks. There are a lot of things in C++ that have interesting performance characteristics (templates allow more inlining, so make microbenchmarks faster but can cause you to run out of i-cache and make the whole program slower, virtual functions prevent inlining unless the compiler can do devirtualisation, but are actually slightly faster to call than cross-library calls via a PLT if they're not inlined). Generally, algorithmic improvements will make a bigger difference than any language feature. The main reason for using templates should be to eliminate copy-and-paste coding, not to improve performance.

Comment Re:Equality (Score 1, Interesting) 490

How did they control for biases coming from parents? Research that I've read shows that gender stereotypes start to be instilled within the first few days after a child is born. Unless they're testing with children that have never seen a toy of any kind before, then the toy experiments are not detecting biological biases, they're picking up on a mix of inherited and learned responses. There's a lot of very bad science done to try to claim that there are things that girls like and things that boys like, ignoring the fact that the things that girls like vary wildly between countries and even over time in the same country (for example, blue was a girls' colour and ping a boys' colour in most of Europe until 1-2 centuries ago, and horses have swung between the two as a stereotypical interest several times).

Comment Re:Rhino horns don't even work! (Score 4, Informative) 163

for the vast majority of the Chinese people, over 90%, do not believe in the effectiveness of the rhino horns

So that's a target market of only 136 million?

with the exception of those living in the Hong Kong and surrounding region (mainly Guangzhou)

Oh, and they're only concentrated in one of the wealthiest areas? Definitely not a problem then.

Comment Re:Infinity (Score 1) 1067

It's not a problem for floating point, where division by zero is well defined (it's a NaN value). And division by almost-zero is not a problem in floating point either, though if you're going down one of the pipelines for dealing with subnormal values then be aware that it's likely 10-100 times slower than normal floating point calculations.

Comment Re:Google is an advertising company (Score 1) 161

I'm surprised that it's taken this long. I've thought that MS and Apple should have been incorporating aggressive anti-tracking and ad blocking capabilities into IE and Safari for a few years, because neither company makes much money from ads, both could easily spin it as a user-centric decision, and it would hurt Google a lot.

Slashdot Top Deals

Software production is assumed to be a line function, but it is run like a staff function. -- Paul Licker

Working...