2 ms·
I feel like people are assuming that the only reason you write assembly is for performance. I try to stay as far away from it as possible, but sometimes there i
by chacham15 13y ago
I feel like people are assuming that the only reason you write assembly is for performance. I try to stay as far away from it as possible, but sometimes there is no other way (barring finding a library that itself has written assembly). Some examples: finding a backtrace, getting the CPUID, or calling a function of arbitrary number of arguments (for some reflection like capabilities: imagine a function like "void foo(void (* func)(), ArrayList * args, char * arg_types)" and getting foo to call func with args passed as arguments, not an array). If you can, you should try and find a library to do those tasks, but the libraries themselves have no choice but to write assembly as you just cannot do those things in plain C.
- benjamincburns 13y agoAbsent of other details, I think in most cases this is an argument to go higher-level, not lower-level.