Kill implicit joining of adjacent strings
bearophile
bearophileHUGS at lycos.com
Thu Nov 11 04:09:10 PST 2010
Rainer Deyke:
> Wait, what? That's a static assert. How can it both assert and compile
> with no errors?
You are right, what I meant is that if you remove the assert the program compiles with no errors (also note the number 5 that is different from 4 strings):
enum string[5] data = ["green", "magenta", "blue" "red", "yellow"];
void main() {}
> In the latter case, 'f' receives an expression (which
> can be evaluated at compile time) as argument,
I meant the concatenation to be evaluated at compile-time for sure, so there is zero runtime overhead.
> so the string may not be
> zero terminated. This is a critical difference if 'f' is a (wrapper
> around a) C function.
I hope Don's idea on this (thank you Don) will be enough.
---------------------
Again, sorry for the tone of my original post of this thread.
Bye,
bearophile
More information about the Digitalmars-d
mailing list