Hello good and kind people.
I have been told to put some code into Keil MDK ARM. I have been told it works. Here is an extract.
#define loop } long ratishmy(char **IPtab) { char mystring[10]; int temp1; char temp2; char temp3; long ans; temp1 = 2496 temp2 = 0 while ( temp2 < 76 ) { mystring = IPtab(temp2); temp3 = 1; while ( temp3 < 11 ) { CONFIG(temp1) = mystring[temp2][temp3]; temp3 = temp3 + 1; temp1 = temp1 + 1; loop temp2 = temp2 + 1; loop }
What is your opinion of it? I want to either rip it up and start again or if they won't let me do that I might run away from it.
I have seen a number of people comming from PASCAL, thinking that:
#define BEGIN { #define END } ...
Are smart things to do to make the code "easier to read".
Some people just like to put their tender parts on an anvil and then ask "hit me".
#define loop }
loop... It seems the initial programmer is familiar with a language other than C...
I have been told to put some code into Keil MDK ARM. I have been told it works
the pointy haired boss has heard about 'reusable code" and believes all code is reusable.
if code has not been written well and with reuse in mind it is not reusable.
NOW, there is a purpose of using non-reusable code: You can sometimes glean a bit about an I/O issue, maybe find a usable algorithm by not reusing the code, but using it as a reference.
Erik
It must be a test for you. To see how you handle the absurd.
Note that this code may make use of even more interesting #define substitutions.
"I have been told it works."
You have been lied to. As posted, the code will not even compile.
Yes, I can program in C and I am not comfortable with those statements. I have spoken to the team members here and they say they cannot see anything wrong! What I posted is a cut and paste. It is how I received it! it's making me feel ill.
That code must be a contender for most stupid ways to abuse a programming language.
I love } replaced with a #define. I love while loops to implement for loops. I love the use of temp1, temp2, temp3, ... I love ...
The code stinks. Anyone involved in the production of this code should be moved to some other part of the company. Preferably carrying out the trash or similar.
Can you program in C? Are you comfortable with these statements?
mystring = IPtab(temp2);
and
CONFIG(temp1) = mystring[temp2][temp3];
It's for some touch screen configuration software. I've spoken to a few other guys in the department and they can't see anthing wrong with it. I've been starting to wonder whether I'm being too critical. This is my probationary period at this job and I need it, but wonder whether I need it this much.
I'd run away from such a boss! Man, what a mess. Just redo it from scratch. What is this?!
No. As I thought I explained, I have been given this code by my manager and told to put it into a new project using Keil MDK ARM. I am not a dumb-nut student! If you were told to do what I've been told to do, would you do it, try to persuade them to let you improve it or run away?
Let me guess: You stole this code, or got it from somebody to "help" you with homework. What a disaster.
View all questions in Keil forum