3 ms·
You can refactor it into multiple functions (#ifdefs around a line containing just "||"? seriously??), some of which are no-ops on some platforms / configuratio
by geofft 11y ago
You can refactor it into multiple functions (#ifdefs around a line containing just "||"? seriously??), some of which are no-ops on some platforms / configurations, and let the compiler deal with inlining the functions that exist and optimizing out those that don't. (Not that you would have noticed the overhead anyway, probably.)
- DSMan195276 11y agoI agree with you. Not all of this can be refactored into separate functions, but the parts that can't can be refactored to be much cleaner after you remove the #ifdef's made unneeded by the functions. Generally speaking, a lot of the cross-platform stuff in the Linux Kernel is handed this way, and done correctly there shouldn't be any over-head.
- x0x0 11y agoProbably with heavy code duplication though, as eg X clipboard management and X session management appear to be cross-cutting concerns. I mean, if you bury the ugly in just one function, I don't see how everyone is calling this horrid engineering. edit: I read this [1] and maybe the ugly isn't localized =P edit2: since you're reading this, thank you for ag. I use it every day. [1] http://geoff.greer.fm/2015/01/15/why-neovim-is-better-than-vim/ http://geoff.greer.fm/2015/01/15/why-neovim-is-better-than-v...