May 10, 2007
Stewart Gordon wrote:
> "John Ohno" <john.ohno@gmail.com> wrote in message news:f1q9n0$1bd$1@digitalmars.com...
> <snip>
>> A good general template function (will work for anything that can be explicity casted to uint, including chars, doubles, and pointers):
>>
>> uint toUint!(T)(T c) {
>>        return (cast(uint)c);
>> }
> 
> Is there really any point using this when you can just cast when you need to?  OK, so it saves two characters where it's used....
> 
> Stewart.

<con>
It makes someone have to go lookup what toUint actually does.  Rather than being able to tell immediately by virtue of knowing basic D syntax.

<pro>
toUint(3+foo(x)) is a little easier on the eyes than
cast(uint)(3+foo(x)).

--bb
1 2
Next ›   Last »