Variable Parameter functions in Linux

Source: Internet
Author: User
Variable Parameter functions in Linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. I learned C language in my freshman year, and I was familiar with printf functions, but I never thought about the implementation of variable parameter functions. I am very interested in using it today (unfortunately it is not used in the end.

I searched the internet and explained a lot of detailed articles. So I plan to at least take a look at the macro definitions involved. As a result, I created and frustrated the first step: I couldn't find it on ubuntu linux. Header file!

So I used the grep command in the/usr/include/directory to find _ G_va_list from va_list, then to _ gnuc_va_list, and then tracked _ IO_va_list, we found that _ G_va_list, _ IO_va_list, and _ gnuc_va_list are defined in a circle -_-! I really admire gnu developers, so they have to go around in such a complicated pre-processing definition.

However, the source is no longer found after _ G_Config.h. Because it calls But I never find this file. Later, I finally got angry. Input "find/usr/stdarg. h" in the command line and press Enter. Then I went to watch the TV. N hours later... after coming back, I was pleasantly surprised to find this file in the/usr/lib/gcc/i486-linux-gnu/4.2/include/directory. Actually, Khan didn't look for it in the linux header file. However, all related articles on the Internet claim that stdarg. h is part of ansi c. In this case, why not put it under/usr/include? No.

As soon as stdarg. h was opened, it was no longer possible. Because one line is found in a conspicuous position:

Typedef _ builtin_va_list _ gnuc_va_list;

Seeing builtin gives rise to an ominous hunch. It seems that the predefined commands are directly implemented in gcc. As expected, the result of grep is invisible to the Code. This parsing ends now. All of my interest in trying variable parameter functions has been wiped out, and it is estimated that it will not be touched in recent years.

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.