any method to view the trick of compiler?

Discussion in 'C++' started by thomas, Feb 8, 2009.

  1. thomas

    thomas Guest

    class A{
    public:
    int x;
    };
    class B{
    public:
    A a;
    int y;
    };

    in the above code, the comiler is expected to synthesize a default
    constructor for A.

    Is there any method to view the extra code the compiler generates?
     
    thomas, Feb 8, 2009
    #1
    1. Advertisements

  2. thomas

    Bo Persson Guest

    The compiler doesn't generate source code, it generates machine code.
    Your options would be to look at the resulting code in the debugger,
    or request an assembly language listing (if available).


    Bo Persson
     
    Bo Persson, Feb 8, 2009
    #2
    1. Advertisements

  3. Given that x is not initialized at all, I don't think the compiler is
    forced to generate any code at all as the "constructor" of A.
     
    Juha Nieminen, Feb 9, 2009
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.