Feature: C Programming Editorial
Posted by Nick on 13 May 2000, 07:06 GMT
Scott Dial of the TCPA (both of which are down because Dim-TI's server is acting up again =[ ) has written our next (belated) feature on C programming on calculators. It's opinionated, so I have to say that Scott's opinions don't reflect my opinion or that of ticalc.org's. The use of C on a calculator is a horrible waste of space. I love the idea as much as the next guy, but there simply isn't enough space for all the bloated code. GCC doesn't produce the most optimized code by far. *gasp* I understand using it to ruff in some program that you need real quick, but any complex program is going to bloat that much more. I even particurally like the fact that I can port a program for my pc to the 89 relatively easily.
What I can't stand is how many people think that C is so much better than asm... There are some real complex things you can do with C that I would be wary of attempting with ASM, but it still could be done cleaner in ASM. The GCC compiler isn't exactly optimal either. Anyone ever looked at the source (-S) it produces? Who in their right mind would use moveq.l #0,d0 to clear it? It has no clue that there is even a better choice... Or how about it moves values on the local stack that don't even need to be preserved or referenced in that method... movew d0,-2(a6) \ tst.w -2(a6). No one can replace the human mind.
I would hate to see all the programmers of tomorrow using C because it is easier... nothing great is ever easy. C is the lazy mans excuse to not learn to really program the calculator. What's that you say? The AMS was written in C... well yes it was and I hate TI for it. Space is not a luxury on such a small memory capacity. If every new programmer that comes in starts writing everything in C then space becomes even less of a luxury. Long live assembly!
|
|
|
The comments below are written by ticalc.org visitors. Their views are not necessarily those of ticalc.org, and ticalc.org takes no responsibility for their content.
|
|
Re: Feature: C Programming Editorial
|
Zeljko Juric
(Web Page)
|
For everybody who like C, I need to tell that the
next release of TI-GCC library (2.0) will be ready during this month (probably release day is 25. May).
Some of new features will include:
- Standard libraries stdlib.h and stdio. (including standard file handling and TTY printing);
- A lot of functions for symbolic mathematics (including calculus etc.) and expressions pretty printing;
- A set of customizable routines for using all text editor facitilities in your programs;
- A set of routines for event driving programming and hooking into the operating system;
- Set of routines for working with archive memory;
- Over 300 new functions in total;
- Much updated documentation.
This release of TIGCCLIB will show the full power of C programming on TI-89.
By the way, I like ASM, but try to make an engineering or calculus program in ASM. Why nearly all ASM programs are games? Because it is too hard to make anything else in ASM...
|
|
13 May 2000, 13:45 GMT
|
|
|
|
|
|
|
|
Re: Re: Re: Feature: C Programming Editorial
|
Zeljko Juric
(Web Page)
|
Floating point numbers are already supported in TIGCCLIB 1.5, although using non-standard syntax, you need to use a=fadd(b,c) instead of a=b+c, and you need to use a=FLT(3,14) instead of a=3.14. Defining "standard" syntax requires changing of the compiler itself, and I have not enough time to do it. But, I have one note: although TIGCC readme file says that included library is 1.5, this is not true (included library is 1.1). So, YOU NEED TO DOWNLOAD TIGCCLIB 1.5 separately (and one patch/bugfix located in the same directory). But, if you can wait yet one week, download TIGCCLIB 2.0. It surely will be released until the end of this month!
|
|
14 May 2000, 07:51 GMT
|
|
Re: Feature: C Programming Editorial
|
Mark Leverentz
|
Why reinvent the wheel? It is fairly rare that an assembly program will outperform a C program to a degree that a significant number of users would even notice it.
Using C because it is easier is a perfectly valid reason. The simplicity of higher level languages like C allows for better readability, better reuseability, easier to track down bugs, and quicker development time.
|
|
13 May 2000, 17:37 GMT
|
|
|
|
|
Re: Re: Feature: C Programming Editorial
|
JrJinfinity
(Web Page)
|
Being an asm programmer myself, and knowing a c somewhat, I have to disagree with you.
Re-invent the wheel?, sorry but if I'm not mistaken, C was actually programmed in asm.
Both languages have their purposes, and Asm programs are far more efficient, faster, and if you know the code either can be debugged just as quickly as the other, the same is also true for coding.
Tracking down bugs is just as easy in C as it is in asm using a debugger, actually I think it's easier in Asm cause then you know your stuff.
C outperform asm...Ha, that's why Game Companies program the fancy graphics screens and such in Asm, and not C.
Re-using C code, you must not of heard about the Australian kangaroo combat demo...hehehe
Don't put Asm down just cause you don't fully understand it, it is (with the exception of binary) the granddaddy of all programming languages, and the most powerful language around.
-JrJinfinity
|
|
13 May 2000, 19:48 GMT
|
|
|
|
|
|
|
|
|
|
|
Re: Re: Re: Re: Feature: C Programming Editorial
|
MathJMendl
(Web Page)
|
>I highly doubt that any modern Office suite,
>database, or web server was written entirely in
>assembly, if they use assembly at all.
Remember that these are for the computer, whereas ticalc.org is for TI calculator programmers. Computer programs are much bigger and faster than asm programs and asm takes longer to program than C. This is why they use it. Asm is more optimized, faster, and smaller than C (when used well), so for something like a TI calculator, where every few bytes here and there matter and where the processor is slower, asm is much more practical. This is not to say that a C compiler could be used well for the TI, but that it will tend to bloat programs and make them worse than they need to be. Its only advantage for the TI is in time to make the program.
|
|
13 May 2000, 22:16 GMT
|
|
|
|
|
|
|
|
|
|
|
Re: Re: Re: Re: Feature: C Programming Editorial
|
JrJinfinity
(Web Page)
|
>I don't recall ever saying that. I did say that C >has other advantages over ASM that make it a better >choice for most programs. Please read my post before >trying to argue with it.
I read your post, that's exactly what you were implementing whether you were aware of it or not, by stating:
>It is fairly rare that an assembly program will >outperform a C program to a degree that a significant >number of users would even notice it.
The fact of the matter is that assembly programs always outperform C programs, Always.
So you know asm, most people who would say something like that have very limited or No knowledge of assembly.
If they are insulted cause they read it wrong, let them be. What I meant is that if you program in assembly you are more likely to understand output of the Debugging software then if you have no comprehension of assembler since it's often output in hexacode.
>Just because it is powerful does not mean that it is >always the best choice for developing programs. I >highly doubt that any modern Office suite, database, >or web server was written entirely in assembly, if >they use assembly at all.
that is exactly why I stated the first time "Both languages have their purposes", who in their right mind would program such programs for the computer in assembler? We are talking about Calculators here. With limited memory mind you. not computers with x-number of harddrives of unlimited sizes.
|
|
13 May 2000, 22:20 GMT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Re: Re: Re: Re: Feature: C Programming Editorial
|
Mike Grass
(Web Page)
|
>The fact of the matter is that assembly programs
>always outperform C programs, Always.
Hmm, that really depends on what your definition of "performance" is. If you mean that ASM programs will always outperform C programs in terms of speed, then you are correct.
Performance, however, can also mean something explicitly different. Take TI-Chess, for example. I would challenge any asm "guru" to make a chess game half as good as TI-Chess--strictly in asm (and no compiling TI-Chess with the -s option to see the asm source ;). Yes, it is possible, but it is highly unfeasible and would take at least twice as long as it did to develop TI-Chess.
Also, math programs, long the bane of asm programs, are much simpler in C, and the development time is much shorter. True, you may be able to make a program in asm that factors a number rather quickly, but then you have to worry about returning a list of the values to the user to make it usable. Such a program in C is simple, and can also be nearly as fast as a pure asm program.
Lastly, many, many more people know C than asm. Some of them may have excellent ideas for programs, but can't make them fast enough in BASIC and don't have the time to invest in learning asm. One possible answer for them is C. With TI-GCC and soon (hopefully!) TI's SDK coming out, those people have the opportunity to introduce some great programs to the TI community.
I echo the complaints of other posters: namely, why did ticalc.org post this rant? When I read the headline, I was hoping to read an informative article about some unknown (to me) aspect of TI-GCC. When I read it and discovered that it was simply a, dare I say, flame against programming in C for TI's, I was highly disappointed. Does this set a precedent for other peoples' rants? Will we have a "feature" calling for everybody to switch to the native language of TI-BASIC?
Ah well, that's about all I have to say. Mostly, I wanted to get the point across that what Xavier Vassor and Zeljko Juric (and others) have done here is a great boon to the TI community, and shouldn't be shoved aside as an inferior thing. Also, I heard a rumor (I think it was at TI-FR.org) that the next version of doors will be written in C--certainly a tribute to the power and flexibility of C on the TI.
|
|
14 May 2000, 00:25 GMT
|
|
1 2 3 4 5 6
You can change the number of comments per page in Account Preferences.
|