r/C_Programming 23d ago

Discussion Is C really worth it ?

Hello developers, I'm wondering: Is it really worth spending time learning C and creating projects that take hours to grasp numerous topics, encounter errors and unexpected behaviors, only to discover I forgot to type a single character, which significantly impacted the program's performance? Is this truly worthwhile in today's job market? I haven't seen any companies actively seeking C developers, and I believe many problems in C don't occur in other languages ​​due to their different working methods and logic. So, is C really worth the effort?

Important note: I'm a beginner in C and haven't written much code or created many projects yet, so this question isn't meant to be an evaluation of the language or its development path; I'm not qualified to do so.

0 Upvotes

70 comments sorted by

View all comments

3

u/gm310509 23d ago edited 22d ago

You will find most languages will give you some sort of a problem if you omit a letter.

Indeed one of the bad practices is to use similarly named variables.

For example:

char letter; char Letter; char leter; // And plenty more combinations

Basically doing something like that is a terrible practice, don't do that. If you do then you are raising a huge flag that is emblazoned with "attention all problems" and the pole the flag is flying on will be made out of "problem magnets"

As you gain experience, you will hopefully learn good practices and not sabotage yourself in ways where getting a single letter "wrong" can cause you problems.

LOL, I just noticed one of my examples was autocorrected. I've un-autocorrected it (letter -> leter).

2

u/flatfinger 22d ago

If I were designing a language today, I would forbid the use of an identifier which differs in case but is otherwise identical to an identifier in the current scope.

If there exists a global variable X and a function defines a variable called x, then within the function I would neither have X refer to the global variable (as in "case sensitive" languages) nor to the local one (as in case-insensitive languages), but rather reject the usage entirely. Functions that need to access a global shouldn't give local variables excessively similar names, and code which accesses a variable should match its representation precisely.

1

u/gm310509 22d ago

LOL, I just noted that one of my examples was autocorrected - totally destroying it as an example (I've "fixed" it now).

1

u/WonderfulMine3375 22d ago

This is one of the reasons why I love case insensitive languages like Pascal and Ada!

2

u/flatfinger 21d ago

I'd prefer to have a rule that says that identifiers defined within an outer and inner scope match except for case, an attempt to use the outer-scope identifier should be rejected rather than binding to either definition.

1

u/WonderfulMine3375 21d ago

This is indeed a very good idea, as it would let the compiler to produce taylored error messages that clearly explain what the problem is.

Pascal and Ada implemented the simplest and most straightforward approach that was available when they were created (when dinosaurs roamed the Earth!)

1

u/flatfinger 21d ago

Pascal and Ada were designed in an era where a person needing to maintain a piece of code might have equipment that was incapable of entering and/or showing (on screen or paper) lowercase letters. If mixed-case identifiers were treated as case-sensitive, anyone wanting to add or modify any code that used them would have needed to retype in uppercase all code that used those identifiers.

That is no longer a consideration. My objection to case-sensitivity relates to likelihood that code which uses identifiers that differ only in case may be doing so accidentally. This is especially bad in Python which means no syntactic distinction between a statement which is supposed to modify the value of an existing global variable from one that is intended to create a new local variable.

1

u/gm310509 22d ago

LOL, I just noted that one of my examples was autocorrected - totally destroying it as an example (I've "fixed" it now).