3 ms·
I was just reading ui.h. It's been quite a while since I wrote anything in C so this might be a dumb question, but does C not have namespaces? How can major pro
by criddell 9y ago
I was just reading ui.h. It's been quite a while since I wrote anything in C so this might be a dumb question, but does C not have namespaces? How can major projects use third party libraries and not have to deal with naming collisions?
- detaro 9y agoNo, C doesn't have namespaces as a language feature. Guess why all the function names start with ui.
- criddell 9y agoBut ui is a super common prefix. I've seen it used for user-interface variable and function names and also in Microsoft-world in projects that abuse Hungarian notation (unsigned int). Clearly it must not be a problem, I just don't understand how people work around it.
- detaro 9y agoYeah, only ui might not be a great prefix. It is a problem when names clash, and annoying to work around. Either you rename one of them, or you can wrap one library in a library of your own that changes the names.
- yawaramin 9y agoC compilation units have a static section which isn't exposed to the outside world (i.e. other compilation units): https://www.codingfriends.com/index.php/2010/07/13/static-in-c-hide-that-function/ https://www.codingfriends.com/index.php/2010/07/13/static-in...
- andlabs 9y agoI don't know, but I do know I'm in the middle of making sure any non-static symbol name in libui either has a prefix of ui[capital letter] or uipriv[capital letter] to at least ameliorate this madness.