| |
| Posted by J C Calvarese in reply to Lars Ivar Igesund | PermalinkReply |
|
J C Calvarese
Posted in reply to Lars Ivar Igesund
| In article <cdqv2o$1seq$1@digitaldaemon.com>, Lars Ivar Igesund says...
>
>Lars Ivar Igesund wrote:
>
>> Upon running a program of mine, it crashes with the (very helpful) message:
>>
>> "Error: Error: conversion"
>>
>> Can anybody tell me what kind of statements could cause such an error? A line number would have been nice, of course, but I doubt a new version incorporating this will turn up today :).
>
>Well, found it. I was trying to toInt a zero length string. The error message was somewhat terse, though.
I agree it can be hard to understand. I haven't run into this particular problem before, but I see how it would be confusing.
The error message actually includes the invalid string, but in this case the invalid string is "invisible".
Perhaps, we can change line 22 on std\conv.d from
# super("Error: conversion " ~ s);
to
# super("Error: conversion '" ~ s ~ "'");
It would help in this case and probably others, too.
Here's the code I used to observe the problem:
#import std.conv;
#void main()
#{
# char[] s;
# int i = toInt(s);
# int j = toInt("hi");
#}
>
>>
>> Also, is it possible to have line numbers printed for AVs?
>>
>> And ArrayBoundsError (Exception...) isn't very exact for the case where
>> you try to do
>> arr[m..n]
>> when m > n and (0 <= m,n < arr.length).
>>
>> Lars Ivar Igesund
jcc7
|