On 11/7/2026 17:23, rbowman wrote:
> On Sat, 7 Nov 2026 21:53:26 +0000, The Natural Philosopher wrote: >
>> On 07/11/2026 14:37, Peter Flass wrote:
>>> On 11/7/26 04:45, The Natural Philosopher wrote:
>>>> On 07/11/2026 04:09, c186282 wrote:
>>>>> ASM was also *the* way for the older micro-controllers >>>>>    for a long time. However some of the optimized 'C' compilers can >>>>>    now rival ASM for speed and size and you don't have to hand-code >>>>>    bit-banging serial either
>>>> >>>> At some point I idly compiled some gcc C to assembler . I spent a >>>> pointless half hour trying to work out if I could have done it better. >>>> >>>> I couldn't.. >>>> >>>> In terms of modern micros I wouldn't even bother unless I couldn't do >>>> it in 'C'. >>>> >>>>
>>> But then you add all the cruft that GCC drags in and you're back where >>> you started (size-wise, at least).
>> Hardly. >> >>
>>> When PCs were new I used a compiler called "Aztec C" that had almost no >>> overhead in excess libraries, start-up code, etc., unless you asked for >>> them. >>>
>> Well in general you DO ask for them
> > I fixed a 20 year old bug that was caused by the programmer deciding > adding '-lm' to the compilation would be too heavy. iirc his version of > hypot() worked most of the time.
After 60 years of programming, I did not know it was in the library. I always just did h = sqrt(x*x+y*y); but if he did not use -lm, did he do his own sqrt() too? And was this on a machine without hardware floating point?
-- Lars Poulsen - an old geek in Santa Barbara, California