Closed dwzg closed 4 years ago
This is a really good idea. I think I'd prefer it to where you don't have to work out the length of the string when configuring. It's a small detail but will be a large increase in usability.
Yes, I also want to have it without the necessity to set the string length. That's why I kept this as a draft. I will continue working on it, but maybe somebody else has a nice solution for this.
This is the best I could come up with if we still have length as a parameter to remove_substring
.
I suppose we could forgo the length parameter and just add a call to strlen
somewhere in there. And since CPU and GPU get cached, the (very, very small) performance difference won't really matter.
I like your approach to this. I'm working on a function to replace substrings, which could fit nicely into the same config using a second macro. I have a use case for this, as one of my processors is called "Core2" which I want to replace with "Core 2".
This adds a configurable way to remove substrings from CPU and GPU model names. I was not able to make it work with the new REPLACE_CONST_STRING macro. It would be nice if one could omit the substring length in the config, maybe somebody has a neat idea for this.