420 karma · joined Feb 20, 2009 (17y ago) · 99 submissions
comment 13y ago · link · parent
What does the "length" of a string even mean? A database will tell you it has to do with storage. A nontechnical person will say it's the number of symbols. A visual designer might say that it has to do with onscreen width when rasterized in a particular way. None of these people are obviously right or wrong.
It's very useful to be able to count the number of glyphs in a string, or the number of unicode codepoints, or bytes, or pixels when rasterized in a particular way, but "length" isn't clear enough to unambiguously refer to any of them. Any meaning you try to ascribe to the "length" operation is going to be wrong to someone.
comment 13y ago · link · parent
The compiler remains vigilant and uncompromising forever.
It's best to automate everything you can, and ask your team for discipline only as a last resort.
comment 13y ago · link · parent
I don't have to resort to documentation or code reviews to ensure that my teammates write fast, reliable tests. This isn't possible in a language that doesn't restrict side effects.
comment 13y ago · link · parent
We have a convention that all recoverable errors be captured in Either or Maybe. This policy is paying off in a huge way because the type system forces us to think about what error cases mean. This is driving us to write substantially higher-quality code than I've written with other tools.
comment 13y ago · link · parent
You can use spaces only, or you can have a random invisible mish-mash of tabs and spaces.
Nobody EVER gets it right, and if you're coding in something whitespace-sensitive, you're in for a wild ride.
comment 14y ago · link · parent
Think about it this way: "4x slower than native code" means that 80% of the CPU's cycles are being spent on the platform.
With NaCl, it becomes possible to instead spend most of those cycles on extra application richness without sacrificing the customer experience by requiring an installer or plugin.
comment 15y ago · link · parent
Consider this program:
#include <iostream>
using std::cout;
using std::endl;
struct C {
int x;
C(int _x) : x(_x) {}
operator bool() const { return 0 != x; }
};
struct D {
float f;
D(float _f) : f(_f) {}
operator bool() const { return 0.0f != f; }
};
int main() {
C c(9);
D d(2.0f);
if (c == d) {
cout << "Equal" << endl;
}
return 0;
}
g++ 3.4.4 doesn't so much as warn that something is fishy here, even with -Wall.Not only that, but c and d are considered to be equal.
comment 16y ago · link · parent
For instance, I could imagine that a GCC that takes advantage of namespaces, overloaded functions, and template functions (notably: not classes, exceptions, or implicit type coersion) to be quite a lot easier to understand than today's deeply preprocessor-dependent GCC.
It's easy to assume that C++ implies OO, but you really don't need to go that way, and you might not want to if you're starting with a project as old and hardened as GCC.
99.
Reporting Crashes in IMVU: Who threw that C++ exception?(aegisknight.org ↗)
22 points · by implicit · 17y ago · 4 comments