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

 



Forgot your password?
typodupeerror

Comment Re:Do it yourself (Score 1) 30

So don't use STL

Indeed, No True Scotsman would use STL with C++.

clang-tidy and Cppcheck and flaw finder and Sonarqube

The last job I had where I had to use C/C++, we automatically ran an expensive static analysis tool every time we checked in code. I'd estimate that it only found about half of the potential segfaults, and it made up for that by finding twice as many false positives.

Comment Re:Do it yourself (Score 2) 30

The "rules" of mutable collections in STL state that collections may not be mutated while being iterated.

Nope. If I had used st::list instead of std::vector, it would have been perfectly fine and officially supported. (Assuming I changed "i+10" to "i+11" in order to make the algorithm actually terminate, although that change wouldn't affect the vector crash.).

The problem is that there are dozens of different rules you have to remember to apply to the different types of lists and iterators. And that's only talking about that one topic. There are hundreds of other rules covering a multitude of language aspects that you have to mentally apply against every single line of code you write, many of which can potentially cause memory corruption.

Comment Re:Do it yourself (Score 4, Interesting) 30

You don't need the language to enforce memory safety to program memory-safe. The most important thing is, for example, to never touch raw pointers. C++ makes it very easy to avoid this. Rust forces you to avoid it, but just because C++ gives you the loaded gun, it doesn't mean you have to use it. In particular not on your own foot.

That is a dangerous misconception. You don't need to use any pointers to get memory errors in C++:

#include <stdio.h>
#include <vector>
 
int main() {
    std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    for (auto i : v) {
        if (i % 2 == 0) {
            v.push_back(i + 10);
        }
        printf("%d\n", i);
    }
 
    return 0;
}
 
$ g++ -Wall -pedantic t.cpp
$ echo $?
0
$ ./a.out
 
1
2
-947527061
1600570778
5
6
7
8
9

Comment Re:There is already a safe subset of C++ (Score 4, Insightful) 30

languages like Rust exist to put ignorant programmers in straight jackets for their own good

Are you seriously trying to suggest that never allocating memory is not also a "straight jacket"?

You seem to be saying that a currently existing bowdlerized version C++ is safe for close-world problems. Possibly so, but that still leaves C++ unsuitable for open-world problems. That makes C++ only suitable for niche applications. Why learn it?

If you just use Rust or any other memory safe language, you won't have to worry about what kind of "world" you're writing for, or about choosing from a range of increasingly dangerous "profiles".

Comment Re:Probably! (Score 1) 14

Reform copyright, allow derivative works, abolish moral rights. What's the worst that could happen? Solves the problem of AI being "inspired" by existing works. Well, perhaps someone will write a crappy HP-inspired story about Tanya Grotter, a machine-gun wielding lady wizard who goes after bad Chechens (that is a real book, BTW). So what? The goal of copyright is cultural abundance, and that will (eventually) include AI generated works.

Look at Nosferatu, considered to be one of the great vampire movies. The movie was called that because they did not secure the copyright to the Dracula story, and after a lost lawsuit they had to destroy all copies and negatives. Luckily a few survived, and we can still enjoy it.

Comment Re:Hitler and Trump get rid of the comedians first (Score 2) 208

Exactly what background and/or career does prepare one well for the presidency? A law degree? Founding a successful business? A career in politics? An MBA? Perhaps being a comedian. Or perhaps the job (like many high level managerial jobs) is such a complex multi-faceted one that no career is going to prepare you for it, and no background is a great predictor for success. Perhaps it is more about personality than experience, but even that is not a great predictor. I've seen plenty of politicians who looked great for the job, only to turn out complete rubbish, or the other way around. Or a brilliant mayor who turned out to be a shit minister. And it depends on circumstances as well... one of our MPs is remembered as lackluster and ineffectual, but I think he would have been great if times had been different. Likewise I think that Zelensky would have been a so-so president in peacetime conditions... but he stepped up brilliantly after his country got invaded. Kind of how people look back on Churchill... before the war, people didn't think he was all that either.

Comment Re: Stupidity snowballs (Score 0) 102

> School teachers don't have a 1st Amendment right in the classroom, just as I didn't have a 1st Amendment right while in my US Army uniform.

Apples and oranges. In the military one has to learn to STFU or the enemy can hear where you are. A teacher simply describing what LGBTQ+ concepts are shouldn't be an exception to the 1st. There's no logical reason other than religious offense, which then has the church sticking its peanut butter in secular chocolate.

> How do we resolve this [restroom & shower issues]?

There are ways to compromise, but that's a longer topic.

> If the teachers want to express their beliefs

That's NOT what I proposed.

> While in the classroom the teachers should be expected to follow the state specified curriculum or expect to be fired.

It's realistic to answer a simple question from a child, even if it offends religious troglodytes.

Comment Stupidity snowballs (Score 2, Insightful) 102

how numerous friends of his became Trump supporters due to the LGBTQ discussions happening in their children's schools... just not popular and it was a major reason that dickbag was re-elected. Even if it seems like the correct moral decision, the unpopularity of it led to a far worse situation.

GOP successfully spooked parents with LGBTQ+ bullshit. They cherry-picked a few bad apples and painted it as common-place. Plus, school content is controlled at the state level, not national, and was thus moot for the election.*

Stupidficial gimmicks worked on US's gullible population, just like 1930's Germany; Don pulled Jedi Clown Tricks. The parents ALSO need more education in critical thinking. Stupidity snowballs. Maybe America is just too dumb to hold a democracy, as too many want a theocracy. Perhaps we can negotiate an amiable split before they drag blue states into their cave.

* An exception may be firing or jailing teachers for merely mentioning LGBTQ+ in the classroom, which should be protected under 1st Amendment and separation clause, but the GOP SCOTUS seems overly bribed by rich evangelicals handing out grift-wrapped RV's. The idea that a non-transgender student will become transgendered by mere mention is dumber than rocks. Idiots!

Comment Next time may not be so lucky (Score 1) 31

I'm not saying cloud is necessarily riskier than on-premises*, but cloud failures can easily make headlines due to the scope, and such could set the likes of MS into a financial tailspin. While that is perhaps a good thing, they'll hurt a lot of customers in desperation for cash during their spiral to Hell.

* The average org didn't manage on-premises well either.

Slashdot Top Deals

"Religion is something left over from the infancy of our intelligence, it will fade away as we adopt reason and science as our guidelines." -- Bertrand Russell

Working...