M
Malcolm McLean
One of the advantages of C is that you often can second-guess the compiler.Who has that rule? Second guessing a compiler again? And you are aware
of instructions that bulk copy in "only a handful of instructions"?
Possibly you mean clock cycles?
If you know the instruction set, or even if you don't know the instruction set
but you know what type of processor you're compiling for, you can often make
a very good guess what machine instructions you'll generate. So you try to
write functions with four or fewer parameters on architectures where the
calling convention is that the first four go in registers, for example.
There is a case for writing a = b rather than memcpy(&a, &b, sizeof(struct t))
when the processor has a block copy, if the programmer is mentally translating
machine instructions to C and back. One way of generating assembly is to write
a function in C, then gradually replace the C with C instructions that match exactly
one assembly instruction, then mechanically translate from C to assembly.
But generally you're more interested in cycles.