JustasMasiulis / xorstr

heavily vectorized c++17 compile time string encryption.
Apache License 2.0
1.19k stars 193 forks source link

MSVC runs out of template arguments #20

Open ghost opened 5 years ago

ghost commented 5 years ago

Interesting project, I was playing around with it for a bit, up until the point where I noticed that on MSVC the compiler does not like strings that are longer than 1023 characters (fatal error C1202: recursive type or function dependency context too complex).

This seems to be due to the fact that there can only be 2046 template arguments in a single declaration on MSVC (https://docs.microsoft.com/en-us/cpp/cpp/compiler-limits?view=vs-2017).

Is there any way this could be circumvented?

On GCC there is a compiler parameter for this it seems, on MSVC there is not.

JustasMasiulis commented 5 years ago

It is definitely possible to circumvent this by splitting the string characters into multiple types/blocks however I really do not think that anyone should be encrypting strings as long as that.

At 1000+ characters that really sounds more like a resource rather than a string and preprocessing it manually might bring noticeable improvements in compilation times.

People have already complained about compilation times and I managed to reduce the number of recursive functions to a single one and I reckon that adding the ability to encrypt such long sequences will introduce a compilation speed degradation.

Unless it is truly necessary for you I don't really have plans to implement this. Maybe toggle-able with a macro at best.

JustasMasiulis commented 3 years ago

Implementation has changed since the start of this issue, but current string size limit should be around 8000 bytes.

Laamy commented 7 months ago

It is definitely possible to circumvent this by splitting the string characters into multiple types/blocks however I really do not think that anyone should be encrypting strings as long as that.

At 1000+ characters that really sounds more like a resource rather than a string and preprocessing it manually might bring noticeable improvements in compilation times.

People have already complained about compilation times and I managed to reduce the number of recursive functions to a single one and I reckon that adding the ability to encrypt such long sequences will introduce a compilation speed degradation.

Unless it is truly necessary for you I don't really have plans to implement this. Maybe toggle-able with a macro at best.

I would like to say that I've run into this issue while embedding a luau variant into my project

Laamy commented 7 months ago

got some super long strings

ReactiioN1337 commented 6 months ago

got some super long strings

but that seems to be more of a design problem