Suggestion: Remove implicit conversion from T[n] and T[] to T*

Sean Kelly sean at f4.ca
Mon Dec 4 16:37:38 PST 2006


Walter Bright wrote:
> Sean Kelly wrote:
>> Oskar Linde wrote:
>>> Removing the implicit conversion from static arrays (T[n]) and 
>>> dynamic arrays (T[]) to pointers T* may be quite controversial, but 
>>> would help clear up some problems and feels like the right step to take.
>>
>> Would this affect the interpretation of string literals?  ie.
>>
>>     printf( "hello world!" );
> 
> No. String literal implicit conversions can happen independently of 
> implicit type conversions.

Then I think it's a good idea.  It improves code readability and reduces 
the risk of bugs.  I'm quite used to doing this with vectors in C++ 
anyway (via the "address of first element" syntax) and like that the 
conversion there must be explicit.


Sean



More information about the Digitalmars-d mailing list