I am implementing a code generator that generates specific code for each linear algebra expression of the type x = y + w + z or A = B*C + D or whatever. Each expression is assigned with a unique unsigned long id, and at some point i need to wrap this id to a unique function name.
I have found a similar question but was unable to convert the solution to my problem, as I also have to write this code in C++, and as the valid url name are different from the valid C99function name. I don't really know where to start!
Edit : I indeed forgot to mention that a function can be assigned multiple 64bit IDs, so converting the ID to string and concatenating the strings may result in a function name too big to be handled by all compilers
Edit 2 : Okay I was probably not precise enough. I am generating OpenCL code, the generation has the purpose to remove temporaries and reduce kernel launch time. For some reason opencl is based on C99 but some compiles cannot handle very long kernels name ( i had some build errors because of that.) Considering all possibilities (scalartype, operators, inlined functions, etc...), 64bit for the ID is barely enough, but I think it's still enough
vec0 = vec1+vec2 has for example ID 1912142123
vec1 = vec0-vec2 has for example ID 3312098234
vec2 = vec0*scal has for example ID 329084089
These three operations can be put in the same kernel. I want to generate the kernel name for the generated code, and _1912142123_3312098234_329084089 might be too long for some compilers.
Hope it's more clear now