5,109 karma · joined Jun 27, 2012 (14y ago) · 1,639 submissions
comment 13y ago · link · parent
For example, many cities already have lit signs that forbid turns from cross-streets onto oversubscribed roads, your nav system could allow you to pay the congestion fee and get authorization to disregard the sign and take the turn. Similarly, you could get out your smartphone and queue yourself to a destination and be told when you get to leave and take the fast route for free. As long as queuing at home got you to your destination faster than queuing in traffic, it would be the individual best strategy to do it and enough people would use it for it to work.
The hard part is probably doing traffic scheduling at an acceptable latency, for a city like LA you'd need to model the behavior of millions of cars however many iterations your optimization algorithm needs every few seconds. These kind of problems are really computationally expensive, it may not be economical with current systems and algorithms.
comment 13y ago · link · parent
comment 13y ago · link · parent
My core point is that the OP has a theory about there being a school of C programmers that intentionally or unintentionally invoke undefined behavior and expect the compiler to do the right thing. He's doing a pretty good job of backing it up, although I'm not sure I understand what exactly he's proposing to do about it.
... And then he just kind of throws C++ in for the ride, presumably on the argument that C++ is just like C with even more cases for undefined behavior. But that's not correct because he's making both a technical and a cultural argument. C++ is technologically (mostly) a superset of C, the culture is completely different to the extent that Linus famously argued that the main advantage of using C is that it keeps all the C++ programmers out. http://article.gmane.org/gmane.comp.version-control.git/5791...
Of the widely fragmented C++ user base, there are multiple, popular methods of development that encourage true high-level development were you are encouraged to target your code to the abstract/portable machine that the standard uses and not your personal guess of how the compiler should work and avoids doing things that require inordinate care to get right.
Again, C++ is full of practical problems, the kind of undefined behavior cases the OP worries about don't really rank up there among them.
comment 13y ago · link · parent
That said, I don't understand why you still keep putting up awful mostly-C code as if any trained C++ programmer wouldn't yell at you for doing it wrong, even before they saw the part with the error.
for(i = 0; i < input.length(); i++)
Where did you learn this? don't do this. Everyone else knows not to do this. for(i = 0; i < min(input.length(), some_vector.length()); i++)
This is actually worse, though it does have the virtue of probably working. If you want a run-time check, use at(), or better still use an iterator already.C++ has all sorts of issues. It's too hard to learn, it's missing some very useful features, and it has a number of rough edges that you have to learn your way around. But the things being complained about in the OP and by you are not real problems for anything but beginners. There just aren't that many naked array accesses or pointer math operations going on in an ordinary C++ application written in non-C style.
comment 13y ago · link · parent
"There is a wikiality driven split in the English language.
Camp A says that a strongly typed language prohibits immoral implicit conversions, such as "1" + 1 => 2 or even more grotesquely, "1000" == "1e3" => true.
Camp B says that a strongly typed language gives each value a type, and that all operations which do not have well-defined semantics will signal an error rather than allow operations to execute which assume incorrect typing.
Camp A currently owns the articles "weak typing" and most of the article "strong typing". Camp B is settling for teaching the controversy in "Strong vs Weak typing" and putting passive-aggressive little notes on all the articles that Camp A's view is mistaken. "
Did I get it right? If so, camp B is correct and camp A are being dicks about terminology that they're getting wrong.
comment 13y ago · link · parent
this:
vector<int> somevector(100);
somevector[200] = 5;
Is a C idiom translated by cut-and-paste. The unmotivated poking of arbitrary magic-number offsets into a magic-number sized vector is not proper. It's the kind of thing that sets off alarm bells on even the most casual of review.comment 13y ago · link · parent
These are not problems of a language per se, but the original sins of neo-vaxocentrism and confusing "I understand how this might work, at some random abstraction layer" and "I can depend on what happens when I do something stupid". Free your mind of these and the rest will follow.
These low-level bit banging errors are vastly less common than shared-memory concurrency issues, which as far as I can tell are endemic to all code that attempts shared-memory concurrency, in any language. If you want to have an axe to grind about languages that aren't future proof, look there.
comment 13y ago · link · parent
If what they're doing isn't illegal, the state and city governments have the power to pass a law against it that actually gives them fair warning as opposed to nonspecific threats.
If what they're doing isn't illegal and the state and city governments don't want to pass a law against it, there's no reason to substitute the US Attorney's judgement for that of the people whose job it is to enforce the law.
The US attorney's office shouldn't have standing to sue on behalf of the neighborhood. The neighbors might. If it's for some reason in the national interest to make sure that this particular flop-house changes its address, I suppose they could fund the case.
In other words, it is a textbook case of CAF abuse: avoiding criminal trials to get a plaintiff-friendly civil trial, stretching jurisdiction limits, bypassing separation of powers by enshrining prosecutors as policymakers, the whole deal.
comment 13y ago · link · parent
The biggest technical advantage I've noticed C++ having over other languages is that library performance characteristics are documented as part of the portable language spec. I really miss that when I switch to other languages and have no idea if the builtin list class acts like a linked list or a vector or a deque or what.
Knowing that the algorithm you just built out of library components doesn't have a n^3 blowup on some platform is a correctness issue, not a premature optimization. I'm more comfortable that's not going to happen working in C++, and the culture and libraries around it than anywhere else.
Does CL specify that, as part of the specification and not just by convention? I'm having a hard time finding docs to that effect but I don't use Lisp enough to know where to look.
comment 13y ago · link · parent
But seriously, I would expect the maximum possible performance on today's architectures to come from the infamous sufficently smart compiler that can do bytecode generation at runtime. That can at least in theory produce programs faster than any system restricted to ahead-of-time operations, including handwritten AOT assembly. Whatever language can make that practical without having some other crippling performance issue might be able to consistently leave C and every other AOT language in the dust.
comment 13y ago · link · parent
This is causing me some pretty serious issues right now. The C community loves its giant ecosystem of C libraries. Everything on Earth seems to bring in a pile of delicate dependencies on the rest of the C universe. What should be fairly mundane configure, build and deployment problems become nightmares.
C is also more likely than a lot of other languages to use outside tools to generate program text as part of a build. In a lot of other languages developers would use those hairy features everyone complains about instead, and avoid complicating the build for everyone who could otherwise treat their library as a black box.
comment 13y ago · link · parent
It would be perfectly reasonable to write a non-C language runtime targeting Linux against syscall instructions or against Windows' documented system DLL interfaces.
Even if it didn't there's no reason to ever add a C dependency to your system if one of the languages you're already using has sufficient "systems" versatility. Go is clearly intended to fill this role.
tl;dr: you can get past C just fine even on an OS written in C and the C dependency isn't free.
comment 13y ago · link · parent
HSBC has admitted that it is for all practical purposes a criminal enterprise masquerading as a bank. This is not a paperwork mistake or a lapse of oversight, it's their business model. Nobody will be prosecuted. The people performing these admitted criminal acts will be allowed to keep their paychecks, their bonuses, and in many cases, their jobs. No jail time, no criminal records, not even 40 hours of picking up trash in a park.
comment 13y ago · link · parent
Lots of people openly violate federal criminal laws. An enormous number of them, like Swartz in this case, do so non-openly but in a way that a trivial amount of investigative effort would reveal. The vast majority of them are not charged.
This selective prosecution is a de facto policymaking process. It's not enough that the prosecution not be an abuse of discretion, it needs to also be good policy. Saying that the law needs to be amended to stop enforcement might be the technically proper thing to do but it's not the only option open to opponents of the law.