Am 15.02.2011 11:30, schrieb spir:
On 02/15/2011 02:58 AM, Nick Sabalausky wrote:
"Jonathan M Davis"<jmdavisp...@gmx.com> wrote in message
news:mailman.1650.1297733226.4748.digitalmar...@puremagic.com...
On Monday, February 14, 2011 17:06:43 spir wrote:
Rename size-t, or rather introduce a meaningful standard alias? (would
vote
for Natural)
Why? size_t is what's used in C++. It's well known and what lots of
programmers
would expect What would you gain by renaming it?
Although I fully realize how much this sounds like making a big deal
out of
nothing, to me, using "size_t" has always felt really clumsy and
awkward. I
think it's partly because of using an underscore in such an otherwise
short
identifier, and partly because I've been aware of size_t for years and
still
don't have the slightest clue WTF that "t" means. Something like
"wordsize"
would make a lot more sense and frankly feel much nicer.
And, of course, there's a lot of well-known things in C++ that D
deliberately destroys. D is a different language, it may as well do
things
better.
Agreed. While making something different...
About the suffix "-_t", I bet it means type, what do you think? (may
well be wrong, just because I have here and there seen custom types like
name_t or point_t or such) Anyone has a history of C/++ at hand?
Denis
I've seen _t in C code for typedef'ed types.
like
struct foo_s { ... };
typedef struct foo_s foo_t;
and then "foo_t myfoo; myfoo.x = 42;" etc
instead of "struct foo_s myfoo; myfoo.x = 42;" etc
and also stuff like
typedef float vec_t;
typedef vec_t vec3_t[3];
So it is used to indicate that the it's an aliased type.
I don't see the problem with size_t.
It's the type used for sizes. sizeof(foo) (or foo.sizeof in D) uses it.
Cheers,
- Daniel