Compile time string manipulation caveats
Hasan Aljudy
hasan.aljudy at gmail.com
Sat Feb 24 17:26:58 PST 2007
Gregor Richards wrote:
> Hasan Aljudy wrote:
>> I discovered that compile-time functions can't use non-static arrays
>> .. implying that we can't use char[] which is a dynamic array.
>> However, this is essential for any non-trivial string parsing (even
>> for trivial ones, in fact), so how do we overcome this problem?
>>
>
> Uh, compile-time functions /can/ use dynamic arrays.
>
> - Gregor Richards
oh, sorry my mistake,
I had a piece of code which was refusing to be compile-time executed, I
didn't see anything wrong with it, but then I saw this:
------------
expressions in the function may not:
* use pointers, delegates, *** non-const arrays ***, structs,
unions or classes
------------
and thought that was causing the problem ...
It turned out that I had a line:
if( result != "" )
which was causing the problem, I changed it to
if( result.length > 0 )
and my function was executing at run-time now!
More information about the Digitalmars-d
mailing list