Strange cast error in compile-time function

Stéphan Kochen stephan at kochen.nl
Tue Jul 24 11:56:40 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Max Samukha wrote:
>> There are still bugs in the compiler that make writing compile-time
>> functions a difficult task. In your case, the error is caused by
>> retval not being explicitly initialized (in parseUnicodeCSV). Try
>>
>> RowData retval = RowData.init;
>>
>> But even if it is, the function still cannot be evaluated at
>> compile-time. Trying to figure out why.

> The compiler doesn't like string-to-null comparison in 'if' (looks
> like a compiler bug).  Try to make your algorythm not to rely on it.

Many thanks for your help so far! :)

I've fixed it up so it's now no longer complaining about
parseUnicodeCSV. So that's nice progress.

RowData.init was indeed a problem. Getting rid of the null-comparison
didn't work outright, though. I replaced it with:
	if (retval.len == 0)
but it was still complaining. It only started working when I initialized
the string to an empty string.

My guess is it doesn't like any pass-by-reference variable that is
uninitialized or null, and was probably going wrong at:
	if (start >= line.length)
just a couple of lines further down the code.

Now it's complaining about genSingleCategoryIf. I can't seem to identify
this with any of the earlier problems.

I've reattached the latest version.

- -- Stéphan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGpktocFUq0gzqDwQRAtWRAKDUPdPhp8KQ/ePPdjckKah1kG8jCgCgojgB
ABzvVtOoqam9E86/fgRmvpI=
=Ou+U
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unitools.d
Type: text/x-dsrc
Size: 8810 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20070724/c99f1cc4/attachment.d>


More information about the Digitalmars-d mailing list