![]() |
Why I hate c
Code:
void User_Autonomous_Code(void) |
Re: Why I hate c
I totally agree. I'm a professional software engineer with 20 years experience. C is such an unforgiving language. It is difficult to read, easy to make simple errors in syntax, and most compilers won't warn you about things like:
Code:
Process_Data_From_Local_IO;Code:
if (myvar=0) |
Re: Why I hate c
Quote:
Code:
if(0 = myvar) |
Re: Why I hate c
also the reason
Code:
Process_Data_From_Local_IO;Code:
x++; |
Re: Why I hate c
Using a utility like Lint can help with those sorts of errors. Just run it and it will warn you of anything that you probably didn't mean to do.
|
Re: Why I hate c
Code is only as readable as you make it. Make names self-explainatory (or close to it). I tought myself VB, and my naming conventions are based on that.
|
Re: Why I hate c
Quote:
I'm going to a talk by Brian Kernighan next week -- I'll give him your regards! ;) |
Re: Why I hate c
Quote:
under the MPLAB C18 tab "Diagnostics level" you can chose "errors, warnings and messages" and get more dianostic info, but it won't catch it all. |
Re: Why I hate c
Quote:
Code:
while(*t++ = *s++);Code:
if ( my_timer == 0 )Code:
if ( !my_timer )And don't get me started on how numeric operations are performed using the smallest size that the operands will fit in, leaving me to worry about overflows even if I know the end result of an expression will always fit in the variable I'm putting it in. Oops, too late... I apologize. It was a late night last night. And I must admit that the tool does get the job done, with little to no fuss, as long as I remember to use it correctly. |
Re: Why I hate c
Quote:
|
Re: Why I hate c
Quote:
|
Re: Why I hate c
Quote:
--EDIT-- P.S. Sorry for double posting there. :) |
Re: Why I hate c
Quote:
Quote:
Quote:
all in all, most of the faults you described are with this specific implementation of C. Chances are you would find programming for a regular computer with C much nicer. |
Re: Why I hate c
C is one of my favorite languages. While it can be VERY unforgiving at first, it's not too difficult once you get used to the language. I used to make lots of simple errors (forgetting parentheses, failing to end statements with semicolons, etc.), but the frequency of that sort of error decreases significantly once correct C syntax becomes habitual. C is tremendously powerful without being nearly as arcane as assembler; it allows one to easily combine useful low-level operations with high-level procedural and algorithmic code in a syntax that's clear and human-readable. It took me a long time to get used to C, but I now find that it's my language of choice for many programming tasks. Don't blame the language because you made an error. Certain errors may look like obvious mistakes once you find them, but those errors are often similar or identical to operations that one might perform in order to obtain useful results.
For example: Code:
if(file_handle = fopen("foo.bar","r")) |
Re: Why I hate c
Quote:
Yes, c is very capable. It is also very terse. In sufficiently skilled hands, that's a powerful combination. In just slightly less skilled hands, it's a recipe for subtle errors. As for me, I prefer to use a language which is a bit less terse, with syntax that doesn't make it quite so easy to shoot yourself in the foot. |
| All times are GMT -5. The time now is 15:46. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi