any method to view the trick of compiler?

T

thomas

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?
 
B

Bo Persson

thomas said:
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?

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
 
J

Juha Nieminen

Bo said:
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).

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top