View previous topic :: View next topic |
Author |
Message |
bgpartri Guest
|
Compiler Bug? |
Posted: Sun Jul 27, 2003 3:26 pm |
|
|
Is there some reason this code should hang? Am I missing something?
#include <18f452.h>
#include <math.h>
void main(void){
float number_log;
number_log = log(2.0);
number_log += 1;
}
I just put the second executable statement in there so I could single step somewhere. It turns out it isn't needed, because it never returns from the log function.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516407 |
|
|
bgpartri Guest
|
Re: Compiler Bug? |
Posted: Sun Jul 27, 2003 5:24 pm |
|
|
The second include was supposed to be <math.h>.
Since my first post, I have found that exp doesn't work either.
:=Is there some reason this code should hang? Am I missing something?
:=
:=#include <18f452.h>
:=#include <math.h>
:=
:=void main(void){
:= float number_log;
:= number_log = log(2.0);
:= number_log += 1;
:=}
:=
:=I just put the second executable statement in there so I could single step somewhere. It turns out it isn't needed, because it never returns from the log function.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516408 |
|
|
bgpartri Guest
|
Re: Compiler Bug? |
Posted: Sun Jul 27, 2003 5:27 pm |
|
|
Very interesting. I guess <-m-a-t-h-.-h-> gets processed by something along the way to the list.
:=The second include was supposed to be <math.h>.
:=
:=Since my first post, I have found that exp doesn't work either.
:=
:=:=Is there some reason this code should hang? Am I missing something?
:=:=
:=:=#include <18f452.h>
:=:=#include <math.h>
:=:=
:=:=void main(void){
:=:= float number_log;
:=:= number_log = log(2.0);
:=:= number_log += 1;
:=:=}
:=:=
:=:=I just put the second executable statement in there so I could single step somewhere. It turns out it isn't needed, because it never returns from the log function.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516409 |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
Re: Compiler Bug? |
Posted: Sun Jul 27, 2003 8:24 pm |
|
|
You should add a while(1) to keep the processor from going to sleep.
:=Very interesting. I guess <-m-a-t-h-.-h-> gets processed by something along the way to the list.
:=
:=
:=:=The second include was supposed to be <math.h>.
:=:=
:=:=Since my first post, I have found that exp doesn't work either.
:=:=
:=:=:=Is there some reason this code should hang? Am I missing something?
:=:=:=
:=:=:=#include <18f452.h>
:=:=:=#include <math.h>
:=:=:=
:=:=:=void main(void){
:=:=:= float number_log;
:=:=:= number_log = log(2.0);
:=:=:= number_log += 1;
while(1);
:=:=:=}
:=:=:=
:=:=:=I just put the second executable statement in there so I could single step somewhere. It turns out it isn't needed, because it never returns from the log function.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516413 |
|
|
bgpartri Guest
|
Re: Compiler Bug? |
Posted: Sun Jul 27, 2003 8:51 pm |
|
|
Thanks. I don't think I would ever have figured that out.
I was still stumped for a while about why my real program still didn't work. I was not programming enough memory. For whatever reason, MPLAB didn't give me an error. It was falling off the end of the program in some way. That program did have a while(TRUE); at the end.
Anyway, its fixed now.
:=You should add a while(1) to keep the processor from going to sleep.
:=
:=
:=:=Very interesting. I guess <-m-a-t-h-.-h-> gets processed by something along the way to the list.
:=:=
:=:=
:=:=:=The second include was supposed to be <math.h>.
:=:=:=
:=:=:=Since my first post, I have found that exp doesn't work either.
:=:=:=
:=:=:=:=Is there some reason this code should hang? Am I missing something?
:=:=:=:=
:=:=:=:=#include <18f452.h>
:=:=:=:=#include <math.h>
:=:=:=:=
:=:=:=:=void main(void){
:=:=:=:= float number_log;
:=:=:=:= number_log = log(2.0);
:=:=:=:= number_log += 1;
:=while(1);
:=:=:=:=}
:=:=:=:=
:=:=:=:=I just put the second executable statement in there so I could single step somewhere. It turns out it isn't needed, because it never returns from the log function.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516415 |
|
|
|