Functions of macros defined as null in some code

Source: Internet
Author: User

/*************************************** ******************************
* Author: Samson
* Date: 05/03/2012
* Test Platform:
* GNU Linux version 2.6.29.4
* GCC version 4.4.0 20090506 (Red Hat 4.4.0-4) (GCC)

**************************************** ****************************/

Check nginx recentlySource codeThe macro ngx_cdecl is included in many function definitions. For example:

Int ngx_cdecl
Main (INT argc, char * const * argv );

Void ngx_cdecl
Ngx_log_stderr (ngx_err_t err, const char * FMT ,...);

The result shows that it has a declaration. It is just a macro defined as null.

# Define ngx_cdecl

After querying the relevant information, I think different compilers on different platforms have different compilation options, it is reserved only for other platforms to have compilation options that need to be added or extended in the future.

For example, when a callback function is declared in a VC environment, _ stdcall, _ cdecl, and _ fastcall are added to the compilation options that specify the function call method on the Windows platform.


Therefore, the macro defined as null is used to reserve the definition of other options for platform porting in the future. It should be just for the convenience of transplantation.

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.