View Single Post
  #8   (View Single Post)  
Old 1st June 2021
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

Quote:
Originally Posted by HopingStar View Post
Also, will you use C over everything?
You should use the right tool for the job. It is clear that over the 50+ year lifespan of C, it has been used for just about everything. Modern C certainly can be used to solve an extremely wide array of problems. It should be just one tool in your ever-growing toolbox.

Notably, none of the BSDs use C for everything: OpenBSD uses Perl for its package manager, FreeBSD famously used Forth for its bootloader, and NetBSD has Lua support in-kernel for rapid prototyping (though this last one is still listed as experimental).

Quote:
Originally Posted by HopingStar View Post
I don't know how to say that, but will it better if I only keep my C knowledge in write kernel, drivers and low lelvel stuff instead of writing software?
C can and is being used to write general-purpose and highly specialized software all day everyday. I've used C to write general-purpose software. But I have also used languages that are not C to write general-purpose software as well. Again, choosing the right tool for the job is important.

Quote:
Originally Posted by HopingStar View Post
C is a beast some people tell me that language is a real beast if I don't want to have more troubles I shouldn't use it much. They said to me "Memory management is a thing you should worry"
Manual memory management can be an issue, but learning how to use C properly can help. That's going to be true of any programming language though. There was a recent article by the curl lead developer about how C mistakes only account for less than 1% of total bugs in curl's lifetime, and C mistakes are caught and fixed significantly more quickly than other bugs. Make of that what you will: https://daniel.haxx.se/blog/2021/03/...re-c-mistakes/

As @Prevet mentioned, C can be difficult to learn due to the fact that you are really learning two languages: C preprocessor and C. Not to mention the myriads of build systems (stick to good old make when starting out). This macro processing in C in the form of the C preprocessor needs to be taken in historical context: such macro preprocessing would not have been seen as so unusual back in those days, as it grew out of assembler macro preprocessors. With that said, when first starting out, with the exception of #include directives and potentially some simple #define directives to make your life easier, you can minimize your use of the C preprocessor and therefore focus on just learning C. Your early C code is highly likely to be exemplary of C's original "portable assembler" ethos anyway, which can also help limit your C preprocessor use.
Reply With Quote