3 ms·
This is an article I wish that every developer who writes libraries (especially for use with games) in C/C++ would read. All of the advice about cleaning up inc
by angersock 13y ago
This is an article I wish that every developer who writes libraries (especially for use with games) in C/C++ would read. All of the advice about cleaning up includes and exports and the whole thing is spot on, and is the sort of thing that will cause me to curse your name a thousand times if you forget it.
One minor point: if your library does file IO, let me override your file operations with my own callbacks, or at least consider providing methods that operate solely on blobs in memory (that way I can populate those blobs however I see fit)--giving me a function that takes a const char* for the filename and then does -~=magic=~- is simply not okay.
- masklinn 13y ago> One minor point: if your library does file IO, let me override your file operations with my own callbacks, or at least consider providing methods that operate solely on blobs in memory (that way I can populate those blobs however I see fit)--giving me a function that takes a const char* for the filename and then does -~=magic=~- is simply not okay. Not only is that an excellent reminder, it's an excellent reminder for every API in every language out there. Though it's not necessarily fun, having to build a shim/layer over FILE* and related functions all the time.