![]() |
Re: Why I hate c
PIC C isn't object oriented like MSC++, which means that you don't have classes and the code Object.Method(Args); is invalid.
|
Re: Why I hate c
Quote:
If you are using a new compiler, one of the first things you should do is see how the warning levels are set, and then set them to how you like them. As people have been finding out, C allows a lot of "strange" things as valid syntax, which is done to increase flexibility and the speed of the language. However, this can lead to some confusing run-time errors. This is why C compilers have warning messages in addition to error messages. If you use the warnings properly, you shouldn't have much issue. Another point: C is like anything else in life: you're not going to be good at it until you practice with it. You'll make errors, you'll find the errors, and then you'll start learning where to look for future errors. In the future, you'll begin to recognize certain behaviors that will help you pinpoint the errors. You know, "hey, I've seen this type of thing before". Just because you've all hit a few stumbling blocks on your first attempt at C doesn't mean it's a bad language. It just means you're not used to it. Give it a little time and you'll soon be wondering how we ever survived with pBASIC. Also: Has everyone been taking advantage of signed math? I sure hope so. It is probably the biggest advantage of the new C compiler vs. the old pBASIC controller. |
Re: Why I hate c
My first roadblock in learning C(++) was the complexity and the amount of "Valids" vs. "Invalids".
Haven't needed signed math. Well, I did write an abs() function for variance stuff. |
Re: Why I hate c
Quote:
If you are doing any serious control loops (a PID feedback control on a robot arm for example), signed math is a real time saver. But... ...C is a language for consenting adults. You can get into a lot of trouble if you are a casual user. Joe J. |
Re: Why I hate c
Quote:
I like C because it let's you do so much, though I agree the single = sign in if statements should probably throw a warning. But I've used it so much now I can usually trace errors like that fairly quickly (or avoid them altogether). |
Re: Why I hate c
All the above discussion is exactly why here in my world, we don't write software by hand any more. It is easy to produce bug free C code that does exactly what you want every time if you have the right software tools. We use an Autocode generator called Rhapsody by I-Logix to generate all of the code we use for the interior systems of all DaimlerChysler vehicles. We write code in a graphical state-machine format and the code generators translate these models into embedded C. In the near future, most software will be developed this way. Now that we have moved from Pbasic, we can apply these methods to robots. I autogenerated the software module for my shift scheduler on BUZZ9 and it dropped right in.
|
Re: Why I hate c
Quote:
|
Re: Why I hate c
Quote:
Does anyone within the sound of my voice have an "in" with Mathworks? I know this would be a huge huge huge step forward in terms of programming robots. Think of how easy it would be to program if you actually had models of arms, motors, Victors, Spikes, valves, cylinders, etc. all ready and waiting for you to drag and drop? You could code your robot before you actually had a robot in stead of what we have now which is the mechanical system gets done in 5.9 weeks, the wiring gets done in .09 weeks and the programmers have .01 weeks to make it all behave. There are a lot of things that are unfair about the FIRST competition, but the stress that we tend to put on the coders is among the unfairest burdens we put on people in this FIRST game. If anyone can get Mathworks to fall in love with FIRST, we would be a long way to making it up to our poor coders. Joe J. |
Re: Why I hate c
Heh, this is possibly off-topic since the thread has wandered slightly from hating C, but here's a beautiful piece of C code and explaination that I snatched from the hacker's dictionary.
Duff's device: n. The most dramatic use yet seen of fall through in C, invented by Tom Duff when he was at Lucasfilm. Trying to optimize all the instructions he could out of an inner loop that copied data serially onto an output port, he decided to unroll it. He then realized that the unrolled version could be implemented by interlacing the structures of a switch and a loop: Code:
register n = (count + 7) / 8; /* count > 0 assumed */[For maximal obscurity, the outermost pair of braces above could actually be removed — GLS] Heh. Took me a minute to wrap my head around it, but I think it's nifty. |
Re: Why I hate c
Quote:
I guess my discomfort with c boils down to the fact that it's a low-level language in high-level language clothing. It's not far removed from assembly language. I do understand the reason for its being that way. That doesn't mean I have to like it. :rolleyes: |
Re: Why I hate c
Quote:
|
Re: Why I hate c
Quote:
|
Re: Why I hate c
Quote:
It is my understanding that Mathworks is still privately owned (ie no stockholders) so it may not be that difficult to get the owners, who are programmers themselves, to agree to help FIRST. They already heavily support academics since MATLAB really got its start in universities. Great Idea Joe! Hope some one can follow through on it. |
Re: Why I hate c
Quote:
|
Re: Why I hate c
Quote:
As I've mentioned before, things are starting to move more toward auto-coding, but this is made possible due to faster, cheaper microcontrollers that can make up for the more inefficient code. However, there is still a high likelihood that we'll be using C for quite a while since there will always be an ultra-cheap product that needs to have too much code crammed into a tiny micro. One last thing about auto-coding: Auto C code generation is just another step up the auto-coding ladder. It's not that revolutionary. Think about it: what is a C compiler other than an auto-coder for assembly language? People used to program with only an assembler. Now the standard is to let the C compiler auto-generate the assembly code and THEN let the assembler go ahead and make the machine code. The next level up is to let TargetLink create the C code, then the compiler creates the assembly code, and so forth. |
| All times are GMT -5. The time now is 00:14. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi