Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror

Comment Re:Sailing the high seas (Score 1) 84

Is there anything worth pirating? I've rediscovered an old hobby... reading. I'm down to just Prime now because it has the most older British detective shows and period dramas (a bit of a favorite with my partner right now). If it was left to me, I'd simply cancel it all. My last Disney+ subscription went unused for a couple of months, save for my daughter and I watching watching Alien Romulus (what a sad waste that was).

So far as I'm concerned they can raise it to a million dollars a month.

Comment Re:Do it yourself (Score 3, Interesting) 86

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 3, Insightful) 86

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) 86

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) 86

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:Transitions (Score 2) 243

Someone didn't live through the loss of the floppy drive, DB9 ports, and parallel ports.

In my day, to plug in a mouse: We took the box apart, installed a proprietary bus card, and then tried to figure out non-conflicting spots for the I/O and IRQ jumpers. Then we typed a bunch of gibberish into AUTOEXEC.BAT. And we liked it!

Comment Do they not read? (Score 1) 173

This isnâ(TM)t new, itâ(TM)s in the sales material and on the dash warnings. The average daily commute is 42 miles (66 for me). I have never needed to drive gas because the temp dropped for my daily commute, ever.

Sure, you might need to take occasional road trips of over 200 miles and want gas, but then you make the rent vs buy decision based on your situation.

Comment Re:Legal/illegal bikes (Score 1) 146

bikes are viewed as a menace because so many cyclists are shitheads and blow through red lights and stop signs, ride on sidewalks endangering pedestrians, and change lanes without signalling (how many even know their hand signals? not even 1 in 10 actually signals while cars almost always do except BMW I have seen no evidence that the OEM signals work on those cars)

Comment Re:Legal/illegal bikes (Score 2) 146

Don't see too many cars on walking paths and sidewalks. The number of e-bikes on walking paths and sidewalks has skyrocketed. It's almost as if someone decided being a pedestrian is a sinful activity, and that every walkway must now be infested with morons on wheels.

Then let me get started on mobility scooters.

Slashdot Top Deals

What this country needs is a good five cent ANYTHING!

Working...