[Coco] C language

Joel Rees joel.rees at gmail.com
Sat Nov 30 22:20:49 EST 2019


2019年11月23日(土) 21:27 Mark McDougall <msmcdoug at iinet.net.au>:

> On 23/11/2019 3:29 am, Salvador Garcia via Coco wrote:
>
> > Presently, I am working on algorithms to convert a relative file path
> > to an absolute one, given the current working directory.
>
> Unfortunately, string manipulation is not one of C's strengths.


Actually, C is very good for working with strings, as long as you
understand the underlying representation, know which libraries to use, and
understand how the libraries work.

And that is essentially the situation with any other language.

And an
> exercise like parsing/converting a file path requires a knowledge of
> pointers, pointer arithmetic, characters, arrays and familiarity with a
> handful of string functions which strictly speaking aren't part of the
> language itself.
>

Well, given that understanding all that is necessary, pointers, pointer
arithmetic, char types and the difference between char and character, and
arrays are very much part of C.

And, while the standard libraries are separable, the standard is not
separable from the standard library, in any version of the standard, or in
any pre-standard compiler.

Other languages are good at hiding the details, up to a point, but, well,
you just need to understand that strings and characters cross the boundary
between well-defined and not well-defined at potentially awkward points.

Also, in a lot of cases, implementations on microprocessors like the
> Arduino often comprise macros and functions which, aside from being
> unique to the platform, can actually make what you're writing less
> C-like in some respects!
>

Also true of any language.

Not that I'm trying to discourage you at all, but merely advising of
> caveats.
>

Yes. The above notwithstanding, forewarned is fore-armed.

Good luck!
>
> Regards,
>


More information about the Coco mailing list