Is there a reason for default-int?

Don nospam at
Tue Dec 29 22:44:59 PST 2009

BCS wrote:
> Hello Ary,
>> Don wrote:
>>> Phil Deets wrote:
>>>> On Mon, 28 Dec 2009 16:18:46 -0500, Simen kjaeraas
>>>> <simen.kjaras at> wrote:
>>>>> Apart from C legacy, is there a reason to assume anything we don't
>>>>> know what
>>>>> is, is an int? Shouldn't the compiler instead say 'unknown type' or
>>>>> something
>>>>> else that makes sense?
>>>> C++ abandoned default int. I think it would be best for D to do the
>>>> same.
>>> D never had default int. When there's an error, the compiler just has
>>> to choose *some* type, so that it doesn't crash <g>.
>> It could be an Error type (that's not an alias for int type) that
>> don't start to spit errors everywhere and instead just blocks all
>> further errors on that type.
> that poses an interesting question: what "type" does this this give?
> int i;
> char[] s;
> int foo(int);
> char[] foo(int,char[]);
> int[] foo(char[],int);
> auto whatType = foo(i ~ s, s);
> i~s gives the error type but DMD could tell that as long as the other 
> args are correct, the only foo that works returns a char[] so does the 
> variable get the error type or char[]?

More information about the Digitalmars-d-learn mailing list