This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

void pointer

Hi,

Any idea what does following do and how ?

((void (code *) (void)) 0) ();

Any help would be great

Parents
  • 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.

Reply
  • 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.

Children