jamessu
Example: when performing a context switch in a kernel, assembly is required since C abstracts away architecture-specific details necessary to swap out the register set, swap the page directory pointer, etc.
I do think that from an educational standpoint, arch linux is a good OS to use, as you will probably get a lot more comfortable with the linux environment. This is largely out of necessity as you will spend a great deal of time setting up and fixing your system.
If you have the time to debug the various components of your system, it can be quite fun and educational to use, but if you're interested in getting work done I cannot recommend arch linux at all.
execve does nothing more than swap out which bytes are loaded into the address space of a program (okay, it does some other book-keeping too, but from 100 feet...). It is not necessary for continuing execution outside of what the program has set up at compile-time. In fact, you can dynamically generate code on the fly, as JIT compilers do.
That said, it's usually much more complicated to change the size of the executable section (this requires modifying the headers and this tends to be a rather involved process), so usually if people are doing binary patches they are only modifying bytes, not adding or removing them.
> It's all about the underhanded trick(s) with the pointers, yours will never compile. I'm forcing clang to do horrible things.
Indicates, to me, that you see this as a strange behaviour that you're forcing the compiler into when in fact this is exactly the intended (and expected) semantics of const.
To the compiler, this:
const int *a;
a = NULL; // perfectly OK
*a = 0; // does not compile
Is a pointer to a constant int, not a constant pointer to an int.You're probably confusing it with this:
int *const a;
a = NULL; // does not compile
*a = 0; // perfectly OK
Which is a constant pointer to a regular int.Of course you can combine both as follows:
const int *const a;
a = NULL; // does not compile
*a = 0; // does not compile
Which is a constant pointer to a constant int (which, of course, makes no sense at all in this case since 'a' is uninitialized and cannot be initialized without an unsafe cast, but it's a perfectly valid statement in C).I think the real issue here is the inconsistency between C standards on details like this. If you can always assume that your code is built with c99 or later, then use all of its features, but in many cases that's not a realistic assumption.