| ??? 01/23/03 22:17 Read: times |
#37034 - RE: Elector electronics competition. |
"... made great point of the fact that the compiler used was sdcc as the designers could not get a comercial compiler to work properly ... something about them not being able to handle recursion..."
More like the designers couldn't be bothered to read the Manual! ;-) "Normal" 'C' implementations use the stack for both parameters & local variables of functions, so that all functions are inherently reentrant. The problem with implementing 'C' on an 8051 is that its hardware stack is totally inadequate to support this! :-( This is why compilers such as Keil do all that messing about with Overlaying - which tries to achieve at compile-time what the "normal" 'C' stack usage achieves at run-time. This is why Keil C51 functions are inherently non-reentrant (and also at the root of all the problems with function pointers). However, Keil C51 does provide a means to create reentrant functions - but it involves the compiler generating code to simulate the action of a stack and is, therefore, grossly inefficient (especially if the simulated stack is in XDATA!!) I did see a post here about SDCC not so long ago which, worryingly, seemed to suggest that this is the way SDCC implements all its functions!! :-0 |



