C extern function returns incorrectly

Jul 24, 2018 at 6:29pm
Hi,

Previously on my programming project,

The returnValue in Init.cpp is about 4.1. When it is returned to the main function, it is 0.

Why is my returnValue different in Get() in Init.cpp and main.c?

Any helps would be very much appreciated.

Thanks.


Last edited on Jul 24, 2018 at 9:57pm
Jul 24, 2018 at 7:00pm
StartTask1() never reads returnValue. It could be that the compiler is simply not doing the store because it figures it's impossible for any code to ever get its value.

What difference does it make if returnValue is zero or not if the code never uses the value for anything?
Jul 24, 2018 at 9:58pm
Thanks. I solved it. Just put a declaration of get in the main.
Jul 25, 2018 at 2:50pm
Please DON'T delete your code after you've got the answer to your question. It makes this thread useless as a learning resource for others. It's a selfish abuse of this forum.

Please edit your OP to restore it with the original code.
Topic archived. No new replies allowed.