Google C++ style guide
bearophile
bearophileHUGS at lycos.com
Mon Oct 5 08:40:54 PDT 2009
Kagamin:
> > I'm for the removal of size_t from everywhere it's not stricly necessary (so for example from array lenghts) to avoid bugs.
>
> Yess, unsigneds are evil. They must go to the camp of gotos and unsafe pointers.
In D it's better to not use them when you want a strictly positive number, or for general iteration purposes, etc. So I don't like to see them used in the built-ins and std lib where they aren't necessary.
I use them when I need bitfields, or when I need the full range (but that's less common).
If you want me to list something that's a little evil, is the automatic silent cast from an integral to its unsigned version. I'd like to disallow such silent cast in D (maybe C# does the same). Walter may answer on this.
Regarding pointers, they are unsafe, but there are ways to increase their safety a little, with no performance costs in release mode. I think this is positive because it helps find and fix bugs in less time.
Bye,
bearophile
More information about the Digitalmars-d
mailing list