Hi, Any idea what does following do and how ? ((void (code *) (void)) 0) (); Any help would be great
I have to agree with Andy. Now that you know what this author was trying to do, the best thing for YOU to do is something entirely different. For instance, if this is done in an interrupt service routine, you're almost certainly going to have a screwed up system after this quasi-reset. And no matter where it's called from, you'll have to take care of the stack pointer, etc. to get things back to the correct state. The best way to reset will always be to turn on the watchdog and then just throw a while(1); in the code and wait for a proper reset.
"... what this author was trying to do ..." Now this author needs to figure out what processor and toolchain he/she is dealing with. http://www.htsoft.com/forum/all/showflat.php/Cat/0/Number/15018/an/0/page/0#15018
Hehe... good find Dan. It must be a bit galling to see a bunch of posts to the effect of "don't do what this hack is doing" when you wrote the code yourself. So it goes...
I think there's a more interesting point in all of this. There are no replies on the HiTech forum except Dan's. There are six replies on the Keil forum. What meaning can we read into this?
Do you really celebrate Xmas in October?
"What meaning can we read into this?" Corroborates the viewpoint favoring the 8051 in the 8051-vs-PIC market share debates?
Even at Christmas time search at http://www.keil.com/support works. Entering "void code" gives several useful answers. Item 7 is: http://www.keil.com/support/docs/307.htm This perfectly answers the initial question.