4 ms·
Subroutines predate structured programming.
by andrepd 4y ago
Subroutines predate structured programming.
- int_19h 4y agoI was using the terminology as OP did, and yes, it is not quite right. But the point as I understood it was that branch predictors optimize around specific "structured" usage patterns of opcodes - in this case, the particular way to use BL/RET to implement function calls typical of C - to the point where any other use is too slow to be practical for anything.
- dustbitying 4y agowhat's the difference between a subroutine an a proper C function?? theyr'e so close to what they're in principle. IMO, C functions are the answer to the problem exposed in the famous quote "goto considered harmful". assembly is all about GOTOs.. C provides a *structure* way to deal with them without getting bored to day (it all becomes way to much to soon) but I think (for reasons that I wish I could get into) that in the end, the goto-based assembly code can go up to multiplication, but then with C and their computer-functions one can go beyond exponentiation. What is there beyond, I can only name by reference but wouldn't say I undesrtand it... which tetration. so riddle me this: why is 2[op]2=4 for all these operations: addition, multiplication, exponentiation, tetration, pentation!? imma go keep being insane. thxbai
- int_19h 4y agoEarly subroutines were really just a branch/return - no stack frames and thus no proper argument passing or recursion or locals. If you've seen a BASIC dialect with GOSUB in it, that's pretty much it. It's a bit more structured than simple jumps, but still much lower level than C functions. Structural programming is traditionally considered subroutines + conditionals + loops. In its purest form, it also means no branches other than the ones implicit in this list (i.e. not only no goto, but also no return, no break/continue etc).