|
Rockbox mail archiveSubject: Re: Problems with rpncalc-2.cRe: Problems with rpncalc-2.c
From: Tom Norris <kaboofa_at_weakmind.org>
Date: Mon, 12 Jul 2004 12:41:49 -0400 BlueChip wrote: > At 16:47 12/07/04, you wrote: > >> Hey everyone, >> >> I'm having problems with getting my Reverse Polish Notation calculator >> plugin working. It seems that my field variables are not being >> modified at all, and I can't pinpoint where in my code that is happening. >> >> If anyone could give me a hand, the least I could do is owe you a pint ;) >> >> My Source can be found on: >> http://code.trancegeek.net/rpncalc-2.c >> >> Thanks! >> _______________________________________________ >> http://cool.haxx.se/mailman/listinfo/rockbox > > > I cannot find the variable "field" ...few comments that will make the > compiler happy though: > > > C89: all variables must be declared IMMEDIATELY after an "{" (open brace) > int b = rb->button_get(true); > ...plus, quite bluntly, if you do not care for the keypress, then this > will do: > rb->button_get(true); > > > static int get_key_press() > should be: > static int get_key_press(void) > > > rb->lcd_invertrect(px*w,7*h,w,h); > Why "7*h"??? Surely that should be "7" ...as taken from > rb->lcd_puts(0,7,"0123456789 +-*/"); > ^^^ > > double rpnstack[5]; > ... > for(i=0;i<=5;i++) > rpnstack[i]=rpnstack[i+1]; > errrr, 0,1,2,3,4,5 ...that's SIX numbers and you've only delared [5] > elements > not least of all to mention that you request [i+1] which will eventually > request element [6] !!! > ...try: > for(i=0;i<4;i++) > > > this element does not exist: > rpnstack[5]=0; > [0],[1],[2],[3],[4] ...that's all you've declared > > > Whether this will fix the "field" problem, I don't know, but it will > sure make a difference > > blOOchip > _______________________________________________ > http://cool.haxx.se/mailman/listinfo/rockbox > > > When I mean uh.. "field" variable.. ahh how's the other way to put it.. global access variables? IE: something that can be read and written to throughout the whole program in all of the functions. Thanks for those pointers on how to keep the compiler happy. _______________________________________________ http://cool.haxx.se/mailman/listinfo/rockbox Received on 2004-07-12 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |