[Development] RFC: new moc feature
kevin.kofler at chello.at
Sun Dec 6 04:01:45 CET 2015
Olivier Goffart wrote:
> Instead, I would suggest something similar to llvm::StringSwitch
Ewww, this is horrible! It will evaluate ALL the result values passed to it,
whether the cases match or not. That works if the values are just enum
constants, as in their example, but if you have any function calls in it,
the complexity and side effects (!) of EVERY function call get triggered.
Plus, in that case, you'd be taking and storing the address of a temporary,
which is a very very bad idea by itself. So this is a very dangerous class.
At most, this can be used to convert the strings into an integer or enum to
feed into a real switch that does the actual work.
More information about the Development