[Coco] C language

Mark McDougall msmcdoug at iinet.net.au
Mon Dec 2 05:12:23 EST 2019


On 2/12/2019 7:03 pm, didier at aida.org wrote:

> Frankly C is far superior for strings,
> it's not handled the standard way basic or other similar languages are 
> doing
> but when you have learnt to use C and well organized your data
> you can have some construction without really moving data, just pointers...

Well that depends wholly on the operations you're doing. You can't 
remove or replace sub-strings for example without moving data...

> 
> in Basic and other similar languages you are often creating or 
> destroying strings
> which result in poor performances and hell for the garbage collector
> I programmed in C for 40 years and frankly with string handling of other 
> languages
> I feel very limited

I've been programming in C for 35 years on everything from Windows UI to 
embedded soft core processors in FPGAs, at application level to kernel 
device drivers, and micro-kernels on microcontrollers, and I'd never 
describe C string handling as "superior".

But there's no point arguing, if that's your experience and that's your 
opinion, then I'm certainly not going to be able to change it. In fact 
you're indeed fortunate that you find string handling so nice in C!

As for performance; that's another argument altogether, and IMHO not 
really relevant to the discussion at hand. Obviously if the language 
does a lot more for you to make string manipulation easier, it's going 
to be less efficient than a library of basic functions that operate on 
null-terminated character arrays. No surprises there. But I'd also argue 
that on modern platforms, it really makes no difference, and string 
handling is likely the least of your worries where bloating and poor 
performance are concerned.

-- 
Mark McDougall
<http://retroports.blogspot.com.au>


More information about the Coco mailing list