February 15, 2011 Re: Integer conversions too pedantic in 64-bit | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | "Nick Sabalausky" <a@a.a> wrote in message news:ijcm8d$1lf5$1@digitalmars.com... > "spir" <denis.spir@gmail.com> wrote in message news:mailman.1648.1297732015.4748.digitalmars-d@puremagic.com... >> >> Rename size-t, or rather introduce a meaningful standard alias? (would vote for Natural) >> > > My bikeshed is painted "native" and "word" :) > ...With some "wordsize" around the trim. | |||
February 15, 2011 Re: Integer conversions too pedantic in 64-bit | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.1650.1297733226.4748.digitalmars-d@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. | |||
February 15, 2011 Re: Integer conversions too pedantic in 64-bit | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | Nick Sabalausky wrote:
> "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.1650.1297733226.4748.digitalmars-d@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.
To my mind, a bigger problem is that size_t is WRONG. It should be an integer. NOT unsigned.
| |||
February 15, 2011 Re: Integer conversions too pedantic in 64-bit | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Monday, February 14, 2011 17:58:17 Nick Sabalausky wrote:
> "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.1650.1297733226.4748.digitalmars-d@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.
I believe that t is for type. The same goes for types such as time_t. The size part of the name is probably meant to be short for either word size or pointer size.
Personally, I see nothing wrong with size_t and see no reason to change it. If it were a particularly bad name and there was a good suggestion for a replacement, then perhaps I'd support changing it. But I see nothing wrong with size_t at all.
- Jonathan M Davis
| |||
February 15, 2011 Re: Integer conversions too pedantic in 64-bit | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.1655.1297736016.4748.digitalmars-d@puremagic.com... > > I believe that t is for type. The same goes for types such as time_t. The > size > part of the name is probably meant to be short for either word size or > pointer > size. > > Personally, I see nothing wrong with size_t and see no reason to change > it. If > it were a particularly bad name and there was a good suggestion for a > replacement, then perhaps I'd support changing it. But I see nothing wrong > with > size_t at all. > So it's (modified) hungarian notation? Didn't that go out with boy bands, Matrix spoofs and dancing CG babies? | |||
February 15, 2011 Re: Integer conversions too pedantic in 64-bit | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Monday, February 14, 2011 18:19:35 Nick Sabalausky wrote:
> "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.1655.1297736016.4748.digitalmars-d@puremagic.com...
>
> > I believe that t is for type. The same goes for types such as time_t. The
> > size
> > part of the name is probably meant to be short for either word size or
> > pointer
> > size.
> >
> > Personally, I see nothing wrong with size_t and see no reason to change
> > it. If
> > it were a particularly bad name and there was a good suggestion for a
> > replacement, then perhaps I'd support changing it. But I see nothing
> > wrong with
> > size_t at all.
>
> So it's (modified) hungarian notation? Didn't that go out with boy bands, Matrix spoofs and dancing CG babies?
How is it hungarian notation? Hungarian notation puts the type of the variable in the name. size_t _is_ the type. I don't see any relation to hungarian notation. And I'm pretty sure that size_t predates the invention of hungarian notation by a fair margin anyway.
- Jonathan M Davis
| |||
February 15, 2011 Re: Integer conversions too pedantic in 64-bit | ||||
|---|---|---|---|---|
| ||||
Posted in reply to spir | spir wrote:
> Rename size-t, or rather introduce a meaningful standard alias? (would
> vote for Natural)
Maybe ptrint and ptruint?
| |||
February 15, 2011 Re: Integer conversions too pedantic in 64-bit | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.1657.1297736740.4748.digitalmars-d@puremagic.com... > On Monday, February 14, 2011 18:19:35 Nick Sabalausky wrote: >> "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message news:mailman.1655.1297736016.4748.digitalmars-d@puremagic.com... >> >> > I believe that t is for type. The same goes for types such as time_t. >> > The >> > size >> > part of the name is probably meant to be short for either word size or >> > pointer >> > size. >> > >> > Personally, I see nothing wrong with size_t and see no reason to change >> > it. If >> > it were a particularly bad name and there was a good suggestion for a >> > replacement, then perhaps I'd support changing it. But I see nothing >> > wrong with >> > size_t at all. >> >> So it's (modified) hungarian notation? Didn't that go out with boy bands, Matrix spoofs and dancing CG babies? > > How is it hungarian notation? Hungarian notation puts the type of the > variable > in the name. size_t _is_ the type. I don't see any relation to hungarian > notation. And I'm pretty sure that size_t predates the invention of > hungarian > notation by a fair margin anyway. > If the "t" means "type", then "size_t" puts "what the symbol is" into the name of the symbol. Even if that *technically* isn't hungarian notation, it's the same basic principle. Aside from that, what's the point of putting "type" in the name of a type? We don't say int_t, float_t, object_t, Widget_t, etc. That'd be stupid. They just simply *are* types. How about making a statement that has "_s" tacked on to the end of its name to specify that it's a statement? "foreach_s", "if_s". It's pointless. If "size" isn't a good name for the type (and it isn't), then the solution is to find a better name, not to tack a "_t" to the end of it. C/C++ has a lot of stupid stuff that C/C++ programmers are used to. Doesn't mean D should copy it. | |||
February 15, 2011 Re: Integer conversions too pedantic in 64-bit | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | The question is then do you want to be more consistent with the language (abolish size_t and make something nicer), or be consistent with the known standards (C99 ISO, et all.). I'd vote for a change, but I know it will never happen (even though it just might not be too late if we're not coding for 64 bits yet). It's hardcoded in the skin of C++ programmers, and Walter is at least one of them. | |||
February 15, 2011 Re: Integer conversions too pedantic in 64-bit | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | Nick Sabalausky wrote:
> I've been aware of size_t for years and still don't have the slightest clue WTF that "t" means.
A _t postfix in C is a common convention to signify that an identifier is a type.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply