The Swedish government had no force measures against him because they believed his attorney that he was still in Sweden getting ready to voluntarily come into the police station for an interview, up to several days after he had left the country, because apparently this "constant surveillance" didn't see fit to bother to mention to them that he was gone. They also believed his attorney's lies for about a month that Assange was getting ready to return to Sweden because this "constant surveillance" didn't even bother to mention that Assange was shopping around for a permanent address. Then when he was under force measures in the UK, and yes, out on bail (ankle tracking bracelet and everything), this "constant surveillance" didn't see fit to mention when he left his court-imposed house arrest and walked into the embassy of a state whose president he'd been recently palling around with on Russian TV.
How F'ing incompetent is this "constant surveillance"?
Right, such "constant surveillance" that when Assange left Sweden nobody bothered to tell the Swedish Prosecutors' office? And then when he jumped bail and beelined for the embassy of a country whose president he'd previously been chumming it up with on RT, nobody bothered to tell anyone to stop him, because...? Is this what you call "surveilance", and if so DAMN are spooks ever incompetent these days...
Careful with your terminology - "rapist" means a conviction; you should use other wording. "Rape fugitive"? Yeah, that's accurate. "Guy with a court finding of probable cause of rape"? Yep. "Thin-skinned combattive prick who calls himself a god to women on his blog and can't even manage a chat with his ghostwriter without leering at 14-year-old girls and giving commentary on whether he thinks they're hot or not"? Yeah. But without a conviction, saying "rapist" is something that could get you sued for libel.
Beyond that: Manning is the opposite of cissy. Manning is trans, not cis.
Also as a side note: insurance fraud (like taking a far cheaper policy than you're actually required to have) passes the costs on to everyone else. And there are costs - that's the reason passenger-for-hire policies are so expensive, people who drive passengers around commercially average far more in claims.
When people underinsure, everyone else pays for it. You're paying to subsidize underinsured Uber drivers' claims.
Consumers are terrible at protecting themselves. "Quality Products / Services" takes third place in terms of things that get a business to the top, after "Excellent PR Control / Advertising" and "Ruthless Business Practices". If you want to see what happens when you reduce consumer protections and monitoring, look to the third world where companies put melamine in their food to artificially inflate the protein count and fake baby formula with little to no nutritional value gets passed off as legit.
"There's like, a whole bare shoulder in that photo. If that's going to offend you"
You have some weird conceptions, as though the reason people have a problem with the choice is because they're offended by the image of skin. A lot of the same voices opposing the use of images that objectify women are supporters of, for example, stopping the banning of images of breastfeeding and the like. It's not nakedness that's the problem. It's making half of the human race into objects seen as worth nothing more than sexual fantasies that's the problem.
I live in Iceland where commercial sexual objectification is illegal - for example, strip clubs and the like (of course, we're also notorious for poor enforcement of our laws, but that's neither here nor there). So do you think we're some sort of puritanical country? Before you answer, I should probably mention that our last prime minister was a lesbian (a fact that went almost unmentioned in the leadup to the elections, nobody gave a rat's arse), Gay Pride is one of our biggest annual festivals (attended by nearly a third of the country), 60% of children our born out of wedlock, 80-90% of first children are born out of wedlock, we have one of the youngest average ages for commencement of sexual activity in Europe, one of the highest average number of sexual partners in Europe, and where the concept of "dating" without sleeping with someone is pretty much an alien concept. Sweden also has similar laws - are they famously puritanical, the Swedes?
(Not to mention that you see your friends and neighbors naked when you go to the pool here... trust me, people here aren't offended by the sight of skin!)
If the bar it's competing against for "widely supported" is raw camera image formats, then that's a pretty low bar to meet. Don't forget that it also has transparency, so it's also competing with (and crushing) PNG, as well as effective lossless compression.
I can really envision this taking off, if it gets adopted as a standard and browsers give it that starting "push". If browsers support it, photoshop and other major tools will as well, and content providers who pay out the nose for bandwidth absolutely will use it. There's even a "legacy mode" javascript decoder for good measure for people who don't have support.
There's ample path to adoption. If it becomes a standard, browsers will implement it and major graphics tools will support its creation. Wherein major content providers who still have large bandwidth bills will use it to reduce their bandwidth requirements. The wider the adoption, the more the usage. We've seen new video formats effectively obliterate older, ubiquitous formats a number of times. We're overdue for the equivalent with still images. There's also the issue that it offers developers a number of nice additional features, like efficient lossless compression modes, transparency and HDR. That's huge - it's not just competing with JPG, it's also competing with *PNG*, and it's *way* smaller than PNG.
There's also specialty apps. Think, for example, something like Google Earth which is constantly downloading vast amounts of texture data. Waiting for that data (as well as the height data) is why you have to wait for Google Earth when you move to a new location. The more high-detail texturemapped objects (like buildings) that get added, the more important good compression is going to be.
There's tons of other reasons, but the basic point is, if it truly is "generally agreed as significantly better", and becomes a standard implemented by browsers and major graphics tools, it will get adopted. Maybe not instantly, but it definitely will happen.
It's a kernel, not a userland program. It's never going to be as simple as a userland program, so it's a bad example
It's *their* example. And you can build a kernel with whatever language, compiler and libraries you want - all that matters is what assembled machine code comes out of it. And the whole point of standardized libraries is to prevent bugs. Having everyone reinvent the wheel is asking for bugs. When a few tens of millions of people use, say, std::vector for a couple decades, you kind of expect the bugs to be worked out.
Your not-clever code really does look like your cat flopped on the keyboard
Your boasting about your ignorance is well taken.
You also didn't type all the C++ boilerplate junk.
Yes, I did. All I left out was the #include and the defining of local_var1, local_var2, and do_something() (because the whole point is that they're whatever the programmer wants them to be). Everything else is included. I even included "std::" rather than assuming "using namespace std;".
[Compressed C++ gibbberish for my ego to stand upon here] Write me the equivalent in C. Never mind the fact that things are done differently in C than in C++
First off, there's nothing "compressed" about that, if by compressed you mean obfuscated. Any person who knows even rudimentary C++11 will understand that code right away. Secondly, all it means is "Run do_something with two local arguments in a thread and detach it". What fundamentally different approach are you envisioning for C++ that makes it no longer desirable to run functions in threads?
every single comment you've posted on this thread screams "I'm an asshole who knows more than everyone here!
Says the person who doesn't even understand simple C++11 code yet feels compelled to rant about how horrible C++11 is compared to C.
Here's a challenge that's about as correct as yours: write some C++ that does all that junk you're blathering on about without requiring the bloated STL
Saying "Use C++ without STL" is like saying "use C without the standard C libraries". It's an idiotic request. Secondly, "bloated"? Go benchmark qsort vs. std::sort and then come back here and tell me about how "slow" C++ is (hint: as is true in most cases, the STL version is faster; templates allow the compiler to do optimizations impossible on C generics)
And if you mean for start_do_something(arg1, arg2) to be a function that creates a thread, then you're just passing the buck. What's the code for that function?
Yep. It's a bane to magic, and bags of holding are magical. There's a saying with nethack: "The Dev Team Thinks of Everything" Half of the source code is probably taken up by easter eggs. Check out a random assortment of them here. Some of my favorites are how a Quantum Mechanic can drop a box containing Schrodinger's Cat which - unlike all other objects in the game - doesn't have its life / death state determined until you open the box; and tricking gods into killing creatures for you by ticking them off into trying to kill when you're engulfed by a monster (which gives you the experience;) ). There's even some things in the source code that players never see, like a commentary about why angry gods don't notice certain details, relating it to how some nuns would shower clothed so that God wouldn't see them naked - as if God is a peeping tom with X-ray vision that can penetrate convent walls but not a bathrobe.
You could go to a semi-realtime version if there aren't too many players, where you can issue any string of commands (including multi-turn commands like walk-to) and they execute sequentially until any player doesn't have an action queued up, some "demands a player's attention" event has occurred, or a player decides to interrupt their commands. You could give other players the option to force the current turn to end if any player hasn't taken an action and a minimum amount of time has passed.
Honestly, though, I'm not sure how much advantage multiplayer would bring to the game vs. the disadvantages. Maybe you could have fun with it, though, having one person be the player and one person being the "god of the random number generator" trying to hinder the player's progress;) The player could be given certain advantages to assist them over standard play (say, free stat boosts and some starting wands / blank scrolls / marker / potions of holy water / etc), while the other person could be given some limited leeway to skew random monster creation, room creation, etc - not full control, just enough to be annoying, as if they have a slowly regenerating "mana" and can spend it on influencing random events, with the most evil influences being the most expensive;)
"Oh, gee, there was a *polymorph trap* in that hallway? How'd THAT get there?" "Hey, you're blind now? Wouldn this just be a TERRIBLE time for a SWARM OF KILLER BEES to show up?" "Wow, YET ANOTHER unidentified ring turns out to be cursed! What are the odds?!" "You know, I'd recommend actually hitting that troll before he kills you rather than MISSING eight times in a row!"
You could say that they're playing the Wizard of Yendor or something;)
So your argument is "because there exists a piece of software, the language of which it was developed in being chosen 23 years ago, then all pieces of software should choose its language too"? Impeccable logic. Who can argue with that?
Let's take a look at how a typical part of the Linux kernel deals with threading, shall we? Here's the first random example I came across in a quick grep of a source tree - drivers/mtd/ubi/build.c
First, we have to declare a struct (in a different file, ubi.h) to hold the data we want accessible in the thread:
struct ubi_device {//... Sniped - miscellaneous needed data fields...
struct task_struct *bgt_thread;
int thread_enabled;
char bgt_name[sizeof(UBI_BGT_NAME_PATTERN)+2];//... Sniped - more miscellaneous needed data fields... };
Now we need a struct to manage all of our threads' arguments:
/* All UBI devices in system */ static struct ubi_device *ubi_devices[UBI_MAX_DEVICES];
UBI_MAX_DEVICES having already been defined in the.h. Now, of course, to be able to access the device, we need lots of helper functions. Among the half dozen or so:
spin_lock(&ubi_devices_lock);
ubi = ubi_devices[ubi_num];
if (ubi) {
ubi_assert(ubi->ref_count >= 0);
ubi->ref_count += 1;
get_device(&ubi->dev);
}
spin_unlock(&ubi_devices_lock);
return ubi; }
When they want to insert, they have to do stuff like:
for (ubi_num = 0; ubi_num... to merely even find a place to insert.
So, let's look at the specific thread creation function:
int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset) {
struct ubi_device *ubi;
int i, err, ref = 0;/*
* Check if we already have the same MTD device attached.
*
* Note, this function assumes that UBI devices creations and deletions
* are serialized, so it does not take the &ubi_devices_lock.
*/
for (i = 0; i < UBI_MAX_DEVICES; i++) {
ubi = ubi_devices[i];
if (ubi && mtd->in
That, of course, does not even remotely meet the spec I presented above. And it's not even standard.
This isn't a challenge to write a replacement to Xorg or anything. It's one damned line of code, people, with your test case given to you, representing a common scenario. How freaking hard can that be? The fact that nobody on a slashdot thread full of pure-C fanboys can't manage this simple task just speaks volumes as to how terrible threading is in C.
how most C programmers would do it though was already given: start_do_something( arg1, arg2 ); simply because it is clear, and you will not have a ton of entry points to threads in most programs.
Well said, Programmer From 1983. Single core processors are the future! GUI hangings are just part of the business! Trivial background tasks should be spawned with exec* and communicated with via IPC!
That's surprisingly little energy. Blue light is that band about 2,7 eV per electron, so 2,7 * 3e18 = 8,1e18 eV/s/m^2 = 1.3 W/m^2. If you wanted to generate that much via a LED bulb with an external quantum efficiency of 20% then it'd take only 6,5 watts.
Is it really possible that a little 6,5W blue LED bulb could kill all the fruit flies in a square meter box - are insects really that sensitive to light? That would be amazing. Greenhouses that use supplimental lighting could fine-tune their frequencies to kill off particular pests pretty darn easily. A grower with heavy LED light supplimenting uses a couple hundred watts of LED per square meter. I mean, at those levels the right frequencies should be killing bugs on the *undersides* of leaves....
Quite true. It's usually novice programmers who are obsessed with trying to optimize every line and produce code that's a damned mess, impossible to maintain, and usually not actually that fast. There's an old joke:
First rule of optimization: Don't. Second rule of optimization (experts only!): Don't yet.
That is, of course, tongue in cheek. Optimization is often important. But trying to optimize every line is an idiot's approach that leads to terrible programs. A person who knows anything writes nice clean code, then runs it through a profiler to see where it's actually wasting time. Then they optimize the heck out of it - but not with stupid stuff like hand-inling functions and unrolling loops, but first off, from a left-brain structural approach. How can the program be changed that reduces how often this loop gets run? Is there a different algorithm that makes better sense here? Then they learn in extreme detail what is actually going on in the compiler and what tools are at their disposal. Could I stick a "restrict" keyword here? If I reduce the size of this array will I get more cache hits? Should I thread this function? Etc. Then they progress down further. Are there math approximation functions I could use here? Could I use a call that calculates multiple values at a time if I group together these data elements? Etc. And then only in the most extreme case do you go all the way down to actual assembly. But by that point, you should already have a pretty good idea of what the assembly is going to look like.
But whatever you do, you just don't just jump in and start doing this sort of stuff everywhere in your code. You profile, run, profile, run, profile, run, and focus your efforts where it'll make the most difference. 99% of your code remains clean and maintainable, and the only obfuscated parts are where there's no choice but to have it obfuscated in the name of performance.
Note: 8 hours later, and not a single person has replaced the single line of C++11 doing a commonly desirable task (running a line of code with a couple arguments in the background any number of times) with C code. How pathetic is your language of choice that such a challenge isn't just a gimme?
Let's say it all togeher one more time: "C++ is not C with classes"
If you don't find a particular C++ approach to doing something (such as custom rolling yourself classes for a matrix app) to be appropriate, then don't do that, but for $DEITY's sake, don't roll your own memory management, basic data structures, and on and on and on.
And I'm sorry, but if you were making a matrix multiplying program with custom-made C++ objects, how on earth did you end up copying whole rows without realizing that's what you're doing? I have trouble picturing that's even possible. How could you be so daft as to write a copy constructor, then set one copy of an object equal to another, and think that your copy constructor wasn't being called?
No, it didn't take template metaprogramming to avoid that before move constructors, template metaprogramming isn't even particularly applicable to such an app. It simply took a move() member function. Move constructors / operators are just a cleaner/prettier way to do that.
There was nothing "broken" to be fixed, except for a programmer who apparently was writing a copy constructor and then copying objects over without realizing that the object was copying itself.
P.s. - your example of "matrix arithmetic classes" makes it pretty obvious that you're talking about some assignment you were given in CS-101 that you probably got an D on. That's one of those sort of tasks that's assigned by professors to try to teach people to understand what objects are but in the real world people rarely write themselves if they ever even use one directly.
*Whoosh*
The Swedish government had no force measures against him because they believed his attorney that he was still in Sweden getting ready to voluntarily come into the police station for an interview, up to several days after he had left the country, because apparently this "constant surveillance" didn't see fit to bother to mention to them that he was gone. They also believed his attorney's lies for about a month that Assange was getting ready to return to Sweden because this "constant surveillance" didn't even bother to mention that Assange was shopping around for a permanent address. Then when he was under force measures in the UK, and yes, out on bail (ankle tracking bracelet and everything), this "constant surveillance" didn't see fit to mention when he left his court-imposed house arrest and walked into the embassy of a state whose president he'd been recently palling around with on Russian TV.
How F'ing incompetent is this "constant surveillance"?
Right, such "constant surveillance" that when Assange left Sweden nobody bothered to tell the Swedish Prosecutors' office? And then when he jumped bail and beelined for the embassy of a country whose president he'd previously been chumming it up with on RT, nobody bothered to tell anyone to stop him, because...? Is this what you call "surveilance", and if so DAMN are spooks ever incompetent these days...
So using the official Wikileaks Twitter account to encourage people to donate to it is merely an "I won't sue you"?
Meanwhile, how about that Chelsea Manning defense fund after Assange milked the Manning case for fundraising for years....
Careful with your terminology - "rapist" means a conviction; you should use other wording. "Rape fugitive"? Yeah, that's accurate. "Guy with a court finding of probable cause of rape"? Yep. "Thin-skinned combattive prick who calls himself a god to women on his blog and can't even manage a chat with his ghostwriter without leering at 14-year-old girls and giving commentary on whether he thinks they're hot or not"? Yeah. But without a conviction, saying "rapist" is something that could get you sued for libel.
Beyond that: Manning is the opposite of cissy. Manning is trans, not cis.
Also as a side note: insurance fraud (like taking a far cheaper policy than you're actually required to have) passes the costs on to everyone else. And there are costs - that's the reason passenger-for-hire policies are so expensive, people who drive passengers around commercially average far more in claims.
When people underinsure, everyone else pays for it. You're paying to subsidize underinsured Uber drivers' claims.
It would also be nice if "our cake" included said company not being run by thin-skinned vengeful machiavellian sexist twits.
Unfortunately, as it stands, the cake is a lie.
Consumers are terrible at protecting themselves. "Quality Products / Services" takes third place in terms of things that get a business to the top, after "Excellent PR Control / Advertising" and "Ruthless Business Practices". If you want to see what happens when you reduce consumer protections and monitoring, look to the third world where companies put melamine in their food to artificially inflate the protein count and fake baby formula with little to no nutritional value gets passed off as legit.
"There's like, a whole bare shoulder in that photo. If that's going to offend you"
You have some weird conceptions, as though the reason people have a problem with the choice is because they're offended by the image of skin. A lot of the same voices opposing the use of images that objectify women are supporters of, for example, stopping the banning of images of breastfeeding and the like. It's not nakedness that's the problem. It's making half of the human race into objects seen as worth nothing more than sexual fantasies that's the problem.
I live in Iceland where commercial sexual objectification is illegal - for example, strip clubs and the like (of course, we're also notorious for poor enforcement of our laws, but that's neither here nor there). So do you think we're some sort of puritanical country? Before you answer, I should probably mention that our last prime minister was a lesbian (a fact that went almost unmentioned in the leadup to the elections, nobody gave a rat's arse), Gay Pride is one of our biggest annual festivals (attended by nearly a third of the country), 60% of children our born out of wedlock, 80-90% of first children are born out of wedlock, we have one of the youngest average ages for commencement of sexual activity in Europe, one of the highest average number of sexual partners in Europe, and where the concept of "dating" without sleeping with someone is pretty much an alien concept. Sweden also has similar laws - are they famously puritanical, the Swedes?
(Not to mention that you see your friends and neighbors naked when you go to the pool here... trust me, people here aren't offended by the sight of skin!)
If the bar it's competing against for "widely supported" is raw camera image formats, then that's a pretty low bar to meet. Don't forget that it also has transparency, so it's also competing with (and crushing) PNG, as well as effective lossless compression.
I can really envision this taking off, if it gets adopted as a standard and browsers give it that starting "push". If browsers support it, photoshop and other major tools will as well, and content providers who pay out the nose for bandwidth absolutely will use it. There's even a "legacy mode" javascript decoder for good measure for people who don't have support.
There's ample path to adoption. If it becomes a standard, browsers will implement it and major graphics tools will support its creation. Wherein major content providers who still have large bandwidth bills will use it to reduce their bandwidth requirements. The wider the adoption, the more the usage. We've seen new video formats effectively obliterate older, ubiquitous formats a number of times. We're overdue for the equivalent with still images. There's also the issue that it offers developers a number of nice additional features, like efficient lossless compression modes, transparency and HDR. That's huge - it's not just competing with JPG, it's also competing with *PNG*, and it's *way* smaller than PNG.
There's also specialty apps. Think, for example, something like Google Earth which is constantly downloading vast amounts of texture data. Waiting for that data (as well as the height data) is why you have to wait for Google Earth when you move to a new location. The more high-detail texturemapped objects (like buildings) that get added, the more important good compression is going to be.
There's tons of other reasons, but the basic point is, if it truly is "generally agreed as significantly better", and becomes a standard implemented by browsers and major graphics tools, it will get adopted. Maybe not instantly, but it definitely will happen.
It's *their* example. And you can build a kernel with whatever language, compiler and libraries you want - all that matters is what assembled machine code comes out of it. And the whole point of standardized libraries is to prevent bugs. Having everyone reinvent the wheel is asking for bugs. When a few tens of millions of people use, say, std::vector for a couple decades, you kind of expect the bugs to be worked out.
Your boasting about your ignorance is well taken.
Yes, I did. All I left out was the #include and the defining of local_var1, local_var2, and do_something() (because the whole point is that they're whatever the programmer wants them to be). Everything else is included. I even included "std::" rather than assuming "using namespace std;".
First off, there's nothing "compressed" about that, if by compressed you mean obfuscated. Any person who knows even rudimentary C++11 will understand that code right away. Secondly, all it means is "Run do_something with two local arguments in a thread and detach it". What fundamentally different approach are you envisioning for C++ that makes it no longer desirable to run functions in threads?
Says the person who doesn't even understand simple C++11 code yet feels compelled to rant about how horrible C++11 is compared to C.
Saying "Use C++ without STL" is like saying "use C without the standard C libraries". It's an idiotic request. Secondly, "bloated"? Go benchmark qsort vs. std::sort and then come back here and tell me about how "slow" C++ is (hint: as is true in most cases, the STL version is faster; templates allow the compiler to do optimizations impossible on C generics)
And if you mean for start_do_something(arg1, arg2) to be a function that creates a thread, then you're just passing the buck. What's the code for that function?
Yep. It's a bane to magic, and bags of holding are magical. There's a saying with nethack: "The Dev Team Thinks of Everything" Half of the source code is probably taken up by easter eggs. Check out a random assortment of them here. Some of my favorites are how a Quantum Mechanic can drop a box containing Schrodinger's Cat which - unlike all other objects in the game - doesn't have its life / death state determined until you open the box; and tricking gods into killing creatures for you by ticking them off into trying to kill when you're engulfed by a monster (which gives you the experience ;) ). There's even some things in the source code that players never see, like a commentary about why angry gods don't notice certain details, relating it to how some nuns would shower clothed so that God wouldn't see them naked - as if God is a peeping tom with X-ray vision that can penetrate convent walls but not a bathrobe.
I was once a developer for Vulture's Eye / Claw. :) Fun times.
You could go to a semi-realtime version if there aren't too many players, where you can issue any string of commands (including multi-turn commands like walk-to) and they execute sequentially until any player doesn't have an action queued up, some "demands a player's attention" event has occurred, or a player decides to interrupt their commands. You could give other players the option to force the current turn to end if any player hasn't taken an action and a minimum amount of time has passed.
Honestly, though, I'm not sure how much advantage multiplayer would bring to the game vs. the disadvantages. Maybe you could have fun with it, though, having one person be the player and one person being the "god of the random number generator" trying to hinder the player's progress ;) The player could be given certain advantages to assist them over standard play (say, free stat boosts and some starting wands / blank scrolls / marker / potions of holy water / etc), while the other person could be given some limited leeway to skew random monster creation, room creation, etc - not full control, just enough to be annoying, as if they have a slowly regenerating "mana" and can spend it on influencing random events, with the most evil influences being the most expensive ;)
"Oh, gee, there was a *polymorph trap* in that hallway? How'd THAT get there?"
"Hey, you're blind now? Wouldn this just be a TERRIBLE time for a SWARM OF KILLER BEES to show up?"
"Wow, YET ANOTHER unidentified ring turns out to be cursed! What are the odds?!"
"You know, I'd recommend actually hitting that troll before he kills you rather than MISSING eight times in a row!"
You could say that they're playing the Wizard of Yendor or something ;)
I've beaten it several times, though I've never achieved my goal of doing so as a pacifist tourist.
To be fair, I've never even gotten close to doing it as a pacifist tourist ;)
So your argument is "because there exists a piece of software, the language of which it was developed in being chosen 23 years ago, then all pieces of software should choose its language too"? Impeccable logic. Who can argue with that?
Let's take a look at how a typical part of the Linux kernel deals with threading, shall we? Here's the first random example I came across in a quick grep of a source tree - drivers/mtd/ubi/build.c
First, we have to declare a struct (in a different file, ubi.h) to hold the data we want accessible in the thread:
Now we need a struct to manage all of our threads' arguments:
UBI_MAX_DEVICES having already been defined in the .h. Now, of course, to be able to access the device, we need lots of helper functions. Among the half dozen or so:
When they want to insert, they have to do stuff like:
That, of course, does not even remotely meet the spec I presented above. And it's not even standard.
This isn't a challenge to write a replacement to Xorg or anything. It's one damned line of code, people, with your test case given to you, representing a common scenario. How freaking hard can that be? The fact that nobody on a slashdot thread full of pure-C fanboys can't manage this simple task just speaks volumes as to how terrible threading is in C.
Well said, Programmer From 1983. Single core processors are the future! GUI hangings are just part of the business! Trivial background tasks should be spawned with exec* and communicated with via IPC!
I ban the STL in my C++ style guide.
I have to say, it's an honour hearing from the author of "How To Program Terrible C++ A Nutshell"
It really depends on what type of app you tend to write. I more often write apps where there's no obvious single owner for a pointer.
That's surprisingly little energy. Blue light is that band about 2,7 eV per electron, so 2,7 * 3e18 = 8,1e18 eV/s/m^2 = 1.3 W/m^2. If you wanted to generate that much via a LED bulb with an external quantum efficiency of 20% then it'd take only 6,5 watts.
Is it really possible that a little 6,5W blue LED bulb could kill all the fruit flies in a square meter box - are insects really that sensitive to light? That would be amazing. Greenhouses that use supplimental lighting could fine-tune their frequencies to kill off particular pests pretty darn easily. A grower with heavy LED light supplimenting uses a couple hundred watts of LED per square meter. I mean, at those levels the right frequencies should be killing bugs on the *undersides* of leaves....
Premature optimization is the root of all evil
Quite true. It's usually novice programmers who are obsessed with trying to optimize every line and produce code that's a damned mess, impossible to maintain, and usually not actually that fast. There's an old joke:
That is, of course, tongue in cheek. Optimization is often important. But trying to optimize every line is an idiot's approach that leads to terrible programs. A person who knows anything writes nice clean code, then runs it through a profiler to see where it's actually wasting time. Then they optimize the heck out of it - but not with stupid stuff like hand-inling functions and unrolling loops, but first off, from a left-brain structural approach. How can the program be changed that reduces how often this loop gets run? Is there a different algorithm that makes better sense here? Then they learn in extreme detail what is actually going on in the compiler and what tools are at their disposal. Could I stick a "restrict" keyword here? If I reduce the size of this array will I get more cache hits? Should I thread this function? Etc. Then they progress down further. Are there math approximation functions I could use here? Could I use a call that calculates multiple values at a time if I group together these data elements? Etc. And then only in the most extreme case do you go all the way down to actual assembly. But by that point, you should already have a pretty good idea of what the assembly is going to look like.
But whatever you do, you just don't just jump in and start doing this sort of stuff everywhere in your code. You profile, run, profile, run, profile, run, and focus your efforts where it'll make the most difference. 99% of your code remains clean and maintainable, and the only obfuscated parts are where there's no choice but to have it obfuscated in the name of performance.
Note: 8 hours later, and not a single person has replaced the single line of C++11 doing a commonly desirable task (running a line of code with a couple arguments in the background any number of times) with C code. How pathetic is your language of choice that such a challenge isn't just a gimme?
Let's say it all togeher one more time: "C++ is not C with classes"
If you don't find a particular C++ approach to doing something (such as custom rolling yourself classes for a matrix app) to be appropriate, then don't do that, but for $DEITY's sake, don't roll your own memory management, basic data structures, and on and on and on.
And I'm sorry, but if you were making a matrix multiplying program with custom-made C++ objects, how on earth did you end up copying whole rows without realizing that's what you're doing? I have trouble picturing that's even possible. How could you be so daft as to write a copy constructor, then set one copy of an object equal to another, and think that your copy constructor wasn't being called?
No, it didn't take template metaprogramming to avoid that before move constructors, template metaprogramming isn't even particularly applicable to such an app. It simply took a move() member function. Move constructors / operators are just a cleaner/prettier way to do that.
There was nothing "broken" to be fixed, except for a programmer who apparently was writing a copy constructor and then copying objects over without realizing that the object was copying itself.
P.s. - your example of "matrix arithmetic classes" makes it pretty obvious that you're talking about some assignment you were given in CS-101 that you probably got an D on. That's one of those sort of tasks that's assigned by professors to try to teach people to understand what objects are but in the real world people rarely write themselves if they ever even use one directly.