This has actually occurred twice now. I'm writing a cross-platform application, and some of my function names conflict with the Windows API. What I did (for example with LoadObject) was...
#undef GetObject
Is this an okay approach, or should I rename my functions?
If you intend for your code to be used alongside of the Windows API, I'd recommend renaming the functions. Yes, that's a hassle, but it's (in my opinion) better than undefining parts of the Windows API, even if you don't use those parts (someone else using your code might need to use those parts).
You could put your functions in a namespace or a class (if applicable). If you are calling within a class then remember the this
keyword. this->aliasedFunction();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With