C is quirky, flawed, and a huge success
LoopyByteloose
Posts: 12,537
Dennis Richie said that, not me.
These days I am enjoying reading, Expert C Programming.
Free PDF link removed as it appears to be a copyright violation.
Buy the book or ebook http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp/0131774298
And sadly, it seems the same issue applies for Kernighan and Richie's The C Progamming Language:2ed which I have previously provided links to.
If you choose to seek out and download PDF versions, do so at your own risk.
======================
Expert C Programming seems to soothe some of the frustration I have had with learning C late in life. It may help younger programmers that were not aware of the history of C, or why Dennis Richie might say such a thing.
http://en.wikiquote.org/wiki/Dennis_Ritchie
BTW, there was a time when programmers were a fun-loving irrevernt lot. Read the book to find out more about that side of the whoe industry.
These days I am enjoying reading, Expert C Programming.
Free PDF link removed as it appears to be a copyright violation.
Buy the book or ebook http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp/0131774298
And sadly, it seems the same issue applies for Kernighan and Richie's The C Progamming Language:2ed which I have previously provided links to.
If you choose to seek out and download PDF versions, do so at your own risk.
======================
Expert C Programming seems to soothe some of the frustration I have had with learning C late in life. It may help younger programmers that were not aware of the history of C, or why Dennis Richie might say such a thing.
http://en.wikiquote.org/wiki/Dennis_Ritchie
BTW, there was a time when programmers were a fun-loving irrevernt lot. Read the book to find out more about that side of the whoe industry.
Comments
That looks like a good read so far. I thank you for sharing that.
http://www.ioccc.org/
For example, the following is an entire C program...
main(a,b)char**b;{int c=1,d=c,e=a-d;for(;e;e--)_(e)<_(c)?c=e:_(e)>_(d)?d=e:7;
while(++e<a)printf("\xe2\x96%c",129+(**b=8*(_(e)-_(c))/(_(d)-_(c))));}
I don't know if he included the flaws in C when he made that statement but I do know that he thought that in at least a few cases the precedence of various operators were "wrong". I snuck into a lecture he gave while I was at Lucent 1999-2000 and he talked about some other design flaws in the language but I have no memory of what they were.
The instructor I had for my first C programming class had at one point worked at Bell Labs as a software developer. She made a habit of reminding us that C wasn't a high level language but rather that it was a high level assembler!
But it doesn't mean you can't extend it so to speak like the way Banzai and the Arduino folks did and make it useful for hobbyists and artists to use all sorts of different microcontrollers all over the world, which is very cool.
I also like C#, nice language.
Exactly!
C or not, adding parens makes things clear. And a compiler/optimizer will hopefully throw out unneeded ones anyways, so the resulting code may be the same. Just the code is more defined.
Basically a binary AND is a * and a binary OR is a +. Over all the languages I used I never found the RIGHT answer of how the precedence is supposed to be. MOST of it is clear. But I tend to put parens around everything I am unsure, like David does. Actually it does not really hurt. Some keystrokes more. And all is clear for the compiler and any human reader of the code..
C quirky and flawed?
Every language I programmed in my live was somehow quirky and flawed. Even COBOL, my favorite.
Up to now there is no perfect language. All of them are domain specific. And they should. It is good.
Enjoy!
Mike
-Phil
Line by line clarity and maintainability wins unless some obscure optimization is required for performance.
-Phil
I generally keep obscure little operators out of my dictionary though ;-)
Right now I am working up a comparision of the Serial and Stream libraries between ANSI C, Arduinio what's it, and Propeller GCC. (... and maybe, Catalina C too.)
Why?
Well Propeller GCC claims to conform to ANSI C.
And the Propelleruino library is suppose to bridge the gap between whatever the Arduino does to serial i/o and Propeller GCC.
I won't make any judgements here other that to say there seems to be some divergence. If is frustrating when pundits simply say all the answers are in Learn or any old C tutorial will get you started with the Propeller.
Of course, Kernighan and Richie just side-stepped the issue by mentioning that all the i/o is in the libraries which are not actually part of ANSI C.
I do not believe there's much controversy in evaluating language design. The goal of an abstract computer language is to capture the semantics of operation in a concise, precise and maintainable fashion. It is the role of development tools to translate abstract programming source into suitable distributable, maintainable executable form and to support debugging of those executables.
C accomplishes none of those goals. It is not a concise source code representation. Its semantics are imprecise and simplistic, although I'd suggest they are really somewhere between crude and vulgar. The entire motivation behind C syntax and semantics would appear to be the reduction of the number of characters in the source file (at the great expense of maintainability and precision) and the simplification of creating a compiler. In short, C is a compiler writer's dream and a software engineer's nightmare. The sad state of the software industry is a testament to that.
That anyone would claim it were a success is beyond me. Shame on Richie and Kernighan and Bell Labs for the travesty that is their legacy.
What's most disparaging is that the science of programming was already well advanced by 1978 when their publication hit the streets as made evident by Aho's Compilers: Principles, Techniques and Tools - affectionately referred to as The Dragon Book - in 1977.
Wow. Not even I would go that far, nor am I capable of such biting eloquence, but it doesn't mean that I disagree. It used to be that Fortran was known as the "language of the streets." But, from your comments, it appears that vulgarity has found a new home. (Are you a book or movie reviewer by trade?)
-Phil
Frankly, many many years ago I wanted the BasicStamps to have C and couldn't see why they couldn't or wouldn't provide it.. I have learned a lot since then. And now I feel a bit embarrassed. The more I learn about GCC, C, and C++; the more I desire to return to Spin, PASM, and Forth on the Propeller.
Catalina C seems to be better documented for the Propeller at this point in time than GCC. But that doesn't make C on the Propeller any better than C on anything else. It is the Propeller that is superior.
Please note that the legality of downloading books from that site is pretty dubious.
This book is still under copyright, and is actually still for sale.
(Kindle edition i $24 )
Wow!
If I were the technical consultant for some hypothetical dictator, and said dictator decided that henceforth his country would have but one programming language, and he assigned me to pick it, I'd pick C in a heartbeat. Hands down. Nothing even comes close to being a universal language, imho. I base this on execution speed, versatility, and flexibility if nothing else.
I personally would pick assembly as the one programming language allowed. Oh that's right C is a high level assembly. :cool: Truthfully though there is a time and place for high level languages like perl and (even though I don't use it) python ( never got past the blocking by indentation thing).
Personally though while knowing C/C++/Java is assumed for software developers looking for a job and if you're looking for a job developing software for embedded control knowing assembly is a must. While spin is nice for what it is and does don't expect to get many software development jobs knowing only spin and pasm!
'
"Basic","C-C+-C+++", "Python","Perl", "Java" And "what ever else" all compile or interpret to some form of ASM.
'
Some are way better than others. This has nothing to do with the Programing lingo.
'
I have noticed that C and Java coder's like to type more the Basic coders.
By Jove, I think you've got it!
Opps. Living in Taiwan seems to allow me to find free PDF versions of texts that shouldn't have such repositories. Should I remove the link to protect Parallax, et al?
You are talking about "K&R" C.
"ANSI" C does include the libraries - e.g. see http://www.csse.uwa.edu.au/programming/ansic-library.html
Ross.
Ray
Unix.
But the way that Kernighan and Richie state it, i/o are not part of the C language and that is why they are in the libraries. I suppose this results in another debate about what is and isn't the C language.
I just uploaded the V0.98 of the SimpleText libary for GCC and the documentation is a huge improvement over what I had that came with my installation of SimpleIDE. This is the library that uses the serial interface and is of key importantance. Nonetheless, there is the Parllax SimpleText way, the ANSI C Standard I/O way, and the Arduino C++ way that uses classes of Serial and Stream.
For a language that is supposed to sustain portablity, Parallax has pretty much ignored the concepts of STDIN, STDOUT, and STDERR and replaced the three with the Debug/Terminal port. And other serial ports are designated as a Device.
++++++++++++
So the assertion that i/o is not part of the C language seems to agree with the fact that asynchonous serial is done a bit differently wherever I look.
Catalina C on the Propeller also has its own vision of compliance of i/o with C portablity. In big programs with few serial ports, the variations may not be a huge issue. Not sure what to say about standard i/o when the Propeller provides keyboard and monitor services that should default to STDIN and STDOUT, with maybe STDERR.
Why am I looking at all this? Well, I thought that it would be easy to port C or C++ code to the Propeller GCC. I am not so sure that I was realistic. It may be quite easy for seasoned programmers and I am just struggling as the documentation for GCC is still in a late Beta condition.
Conclusions --
GCC seems to be getting much closer to be ready for public use.
Though I dislike working without complete documentation and with Beta versions of software; the ability to do so are part of mature programming skills.
If one is waiting for the dust to settle, they are still programming with training wheels.
ANSI standards are helpful, but never quite fit the real work of producing useful software. Committees that have to vote to accept this or that will never quite keep up with real creativity.
I guess I just have to accept that I need to learn C++ and how it uses Object Oriented Programing design, though I was hoping to just learn C.
Ray