Coercion type conversions in a function declaration

Source: Internet
Author: User

How do I write a program that allows the microprocessor to automatically invoke a subroutine at the 0 position at startup?

The first thing we need to do is to find a place where a pointer is pointing at that position, and that position is just another function of any type we need, then the problem can be solved. Let's say we have a function pointer to that location whose type is empty. such as: (*FP) (). The most important question now is how to make the FP point at the 0 position.

We think of a type of coercion. For example, the integer 0 is converted to a pointer to a function of the null type (void (*) ()) 0, which means exactly the same as the FP type, and our purpose is to replace the FP with it.

So this code can be written ((void (*) ()) 0) ().

Coercion type conversions in a function declaration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.