Linux compilation warning would be initialized after

Source: Internet
Author: User

Http://blog.chinaunix.net/uid-17019762-id-3152012.html

As a person with obsessive-compulsive disorder, I can't stand the existence of warning.

This warning is caused by the initialization order ,
    1. The warning code will appear!
    2. Class Cinit
    3. {
    4. Public
    5. Cinit (std::string str, int a): Str_ (str), A_ (a)
    6. { }
    7. Private
    8. int A_;
    9. Std::string str_;
    10. };

    1. Ok
    2. Class Cinit
    3. {
    4. Public
    5. Cinit (std::string str, int a): Str_ (str), A_ (a)
    6. { }
    7. Private
    8. Std::string str_;
    9. int A_;
    10. };

Linux compilation warning would be initialized after

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.