June 07, 2005
On Mon, 06 Jun 2005 17:00:43 -0700, Unknown W. Brackets <unknown@simplemachines.org> wrote:
> The problem with raw is it would commonly be used in programs already as a variable name or similar - at least, I've seen it more than a couple times.  Find me a program that uses "uninitialized"... sure, there may very well be some, but probably not many.

True. However, I'd prefer the *best* word, rather than the one with the least conflicts, at least at this stage in D's development. That said, 'raw' may not be the *best* word. I prefer 'noinit' now ;)

> If you want an uninitialized stack variable, what's wrong with that? Sure, it doesn't save much time - but if the function is being called 1000 times a second, it might be worth it.

True, maybe in those circumstances. It also makes me wonder what effect inlining has on variable initialisations, if any, and how this might tie into that. After all, you'd want your function being called 1000 times a second to be inlined.

> I, probably wrongly, assumed that the gc or more likely other potential gc implementations might recognize all pointer types.  If this is incorrect, you still have classes and dynamic arrays.

I think you're correct, in that we might have one in the future that can tell. The current one, IIRC, cannot.

Regan

>> My take...
>>  Types on which it makes little or no sense to use 'non-initialisation':
>> char[] dynamic; //all dynamic arrays, unless assigned with 'new'.
>> int i; //and other small stack based types.
>> Class ref; //class references
>>  Types on which it is useful:
>> char[100] static; //all static arrays.
>> char[] dynamic_assign = new char[1000]; //all dynamic arrays, assigned  with new.
>>  Basically it seems when a large block of memory is allocated, you want to  choose not to initialise it. I'd suggest the keyword 'raw', and I'd  suggest it's usage be:
>>  raw char[100] static; //as a type-modifier
>> char[] dynamic_assign = raw char[1000]; //as replacement for new?
>>  or perhaps (if you dislike the 'abuse' of the type modifier 'raw' as a  replacement for 'new')
>>  char[] dynamic_assign = new raw char[1000]; //as type-modifier
>>  So, raw would mean uncooked or 0xd34db33f if you will ;)
>>  Regan

1 2
Next ›   Last »