Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

quasar3d

C4355

This topic is 5562 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
why is it not valid? the memory for the object is already created, right? maybe the variables in the class don''t have their content set yet, but the pointer does have it''s value. if I''m sure I won''t use any variables that aren''t initialized yet, then is it ok to disable this warning? or are there other problems

My Site

Share this post


Link to post
Share on other sites
quote:
Original post by quasar3d
why is it not valid? the memory for the object is already created, right? maybe the variables in the class don''t have their content set yet, but the pointer does have it''s value. if I''m sure I won''t use any variables that aren''t initialized yet, then is it ok to disable this warning? or are there other problems

My Site


You seem to understand the ramifications of the warning. As long as you understand that the constructor has NOT been called, and no member data has been initialized, then yes, it''s safe to ignore the warning.

Share this post


Link to post
Share on other sites
This is what MSDN had to say on the subject:

The this pointer is valid only within nonstatic member functions. It cannot be used in the initializer list for a base class.

The base-class constructors and class member constructors are called before this constructor. In effect, you''ve passed a pointer to an unconstructed object to another constructor. If those other constructors access any members or call member functions on this, the result will be undefined. You should using the this pointer until all construction has completed.

This is a level-1 warning under Microsoft extensions (/Ze) and a level-4 warning otherwise.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!