3 ms·
Dead code elimination is only straightforward if your language has sane naming semantics (lexical scope, static name resolution, etc). If your language does cra
by wyager 5y ago
Dead code elimination is only straightforward if your language has sane naming semantics (lexical scope, static name resolution, etc). If your language does crazy stuff like allowing function lookup by the string representation of its name in the source code (e.g. JavaScript) it becomes much harder.
- wffurr 5y agoWhich is why Google's jscompiler requires a stricter subset of JS for "advanced optimizations" including dead code elimination.
- _3u10 5y agoC allows you to call functions by string... C++ also allows it, but the function names are a bit harder to guess.
- Banana699 5y ago> C allows you to call functions by string please elaborate
- garaetjjte 5y agoPossibly OP meant dlopen/dlsym on itself? But that's a stretch, and not really language feature...
- lights0123 5y agoAnd functions aren't guaranteed to be included in the binary unless you pass additional compiler flags with that strategy.
- _3u10 5y agoVery few things are guaranteed in C. If you want to guarantee the function exists let the operating system look up the function names by string for you.
- _3u10 5y agoCreate a string, look up the address of a function in the library. Assign the address to a function pointer, call it.