General > General Technical Chat
How many people code in C these days, and if so, why?
<< < (48/99) > >>
Picuino:
Many times there is no real option to choose the language to use.
With microcontrollers and IOT world, C language is the only serious option to choose.
In other areas there is no better solution neither than C.
Therefore in many cases choosing the C language is a solution without many really good or serious alternatives.

Of course this is not the case in the world of web creation, for making GUIs or many other examples.
bd139:
This just popped into my head. An old Unix koan from ESR. Noted for the C comment...


A Unix zealot, having heard that Master Foo was wise in the Great Way, came to him for instruction. Master Foo said to him:

“When the Patriarch Thompson invented Unix, he did not understand it. Then he gained in understanding, and no longer invented it.”

“When the Patriarch McIlroy invented the pipe, he knew that it would transform software, but did not know that it would transform mind.”

“When the Patriarch Ritchie invented C, he condemned programmers to a thousand hells of buffer overruns, heap corruption, and stale-pointer bugs.”

“Truly, the Patriarchs were blind and foolish!”

The zealot was greatly angered by the Master's words.

“These enlightened ones,” he protested, “gave us the Great Way of Unix. Surely, if we mock them we will lose merit and be reborn as beasts or MCSEs.”

“Is your code ever completely without stain and flaw?” demanded Master Foo.

“No,” admitted the zealot, “no man's is.”

“The wisdom of the Patriarchs” said Master Foo, “was that they knew they were fools.”

Upon hearing this, the zealot was enlightened.
madires:
TIOBE Index for May 2020
May Headline: Programming language C is back in the number one spot
https://www.tiobe.com/tiobe-index/

My take on those silly programming language wars is that you should use what suits you best and what gets the job done. Of course, when you're working in a team or have to maintain some legacy software you don't have the luxury of choosing the language. I don't mind to learn another one. I've stopped counting a long time ago. >:D
Karel:
http://harmful.cat-v.org/software/c++/linus

 :clap:
SiliconWizard:

--- Quote from: Nominal Animal on May 10, 2020, 12:47:50 pm ---typedef enum { true, false, FILE_NOT_FOUND } boolean;

:phew:

--- End quote ---

Uh huh. As was discussed in other threads, C enums are just loose collections of integer constants, and the language doesn't have any provision for type-checking enums (beyond the values being integers).
Just the way it is. Yes it sucks a little.

And yes C99 added a true boolean type (_Bool, or bool if you include stdbool.h) which is guaranteed to hold only 1 or 0 (unless probably you mess with it using pointers and casts).
I've never been really bothered with older C versions not having a true boolean type. All you had to know was that 0 was considered false as a condition, and anything else, true. That worked well enough. There was no point directly testing a "boolean" (I'd say rather a "condition") against a value anyway (something I have already seen from some developers - ugly!) This would make no sense. One way it could make sense would be if you used a bool value not as a condition but as an integer value in some calculation. Something I've seen, but I find this wrong in many ways, and obfuscating. It doesn't even make sense from a strict type point of view IMO.

But likewise, I've once seen someone write stuff like: 'if (someboolean == true)'. Seriously buddy? How much more fucked up can it get? Not only would that lead to bugs in pure C (at least before C99 and/or not using the 'bool' type), but it was stupidly redundant anyway. A condition is just a condition. 'if (someboolean)' is correct and perfectly understandable. The above could get as recursive as possible while retaining the same absurdity: 'if ((someboolean == true) == true)'... What's the difference?

Ahah. I guess you can never really get into someone else's tortuous mind anyway.

OTOH, I make a strict distinction between the above (manipulating values that you consider as conditions, or booleans) and using any other kind of values as conditions. For instance, for testing pointers against NULL, I don't like 'if (pointer)' much, and will favor 'if (pointer != NULL)'. Some may not see a difference. There is. 'pointer' is just a pointer, it's not meant to hold a condition. In C, there is no difference language-wise, but from a coding style POV, I find this inconsistent. To elaborate with this example and link it to the above, if OTOH you used an intermediate variable as a "boolean" holding the same condition, that could be:

pointernotnull = pointer != NULL;
if (pointernotnull ) ...

Hope I made my point clear.
(That was just a slightly off-topic rant/precision.)
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod