>> i used an even worse hack in Quasimodo to allow passing strings via
>> floats. you don't want to know.
>
>I guess you could treat 4 characters as a single 32-bit int and cast
>it to a float? and do the reverse on the other side? but then how to
>terminate the string?
>
>never mind, you were right.
you asked for it now ...
strings[n] = "/goddam/funky/bass/sample.wav";
*((int *)&fltval) = n;
.
.
.
char *str = strings[*((int *)&fltval)];
but it was worse than that. i limited the range of string indices to
24 bits, and used an unused pattern in the 7 exponent bits of an IEEE
float to mark the value as a string index. this let me write
"is_string(float)" ... remembering this almost makes me want to vomit,
but hey, you find another way to pass strings into Csound code that
will only accept floats :)
--p