EsperBot
6 months ago
[Coding] YOU HATE TEMPLATE FUNCTIONS, YOU HATE TEMPLATE FUNCTIONS https://images.plurk.com/5bshN4TvdoBvQYeHVG5ovr.gif
latest #9
EsperBot
6 months ago @Edit 6 months ago
At work the current thing I’m doing is converting all instances of ‘long’ to ‘int32_t’ in a section of the codebase. Even though these data types are actually identical, because the C specification from the 60s doesn’t actually specify the length of int, short, and long, the compiler can’t just plug a long into a function that takes an int32_t or vice-versa.
EsperBot
6 months ago
So I’m also having to make the same change in the other parts of the codebase that CALL the code I’m changing.
EsperBot
6 months ago
Which is very annoying because, again, these two data types are identical.
立即下載
EsperBot
6 months ago
But, whatever. It’s mostly just a lot of building, going to the error message, fixing the call site that the error points towards, build again. Tedious, but easy.
EsperBot
6 months ago
But if the problem is with a template function? Go fuck yourself, Visual Studio says!
EsperBot
6 months ago
Somewhere in the codebase, some thing is calling this function with the wrong types. Where? Who knows! Figure it out yourself, chuckles!
EsperBot
6 months ago
Got to directly inspect everywhere that calls this function to see if you can find the one that’s got a long in the arguments. Or a different data type that is being converted to a long.
EsperBot
6 months ago
In one case I had to resort to commenting out different combinations of function calls until the error message disappeared
EsperBot
6 months ago
And then once I knew where the problem was, work backwards from there to figure out WHAT it was
back to top