Jump to content
  • Advertisement

Archived

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

dave

Returning a pointer to a structure, what is return type?

This topic is 5274 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

hi everyone, just having a problem, i have a structure in the class declaration and i want to write a breif inline fuinction that simpley returns a pointer to thatstructure.
struct PPSETTINGS
		{
			UINT				l_BackBufferWidth;
			UINT				l_BackBufferHeight;
			D3DFORMAT			l_BackBufferFormat;
			UINT				l_BackBufferCount;
			D3DMULTISAMPLE_TYPE l_MultiSampleType;
			DWORD				l_MultiSampleQuality;
			D3DSWAPEFFECT		l_SwapEffect;
			BOOL				l_Windowed;
			BOOL				l_EnableAutoDepthStencil;
			D3DFORMAT			l_AutoDepthStencilFormat;
			DWORD				l_Flags;
			UINT				l_FullScreen_RefreshRateInHz;
			UINT				l_PresentationInterval;
		} l_PresentParams;

void ReturnParams() {return &l_PresentParams;}

Just trying to figure out what the return type is for the function, ie where void is written. thanx in advance, dave

Share this post


Link to post
Share on other sites
Advertisement
Well, it''s a PPSETTINGS*...

Assuming your question was "what should this return instead of void" and not "what happens if I return a pointer to a PPSETTINGS structure when the function is declared as void".

Share this post


Link to post
Share on other sites
In true C (i.e. NOT C++) it should be:
struct PPSETTINGS*

As of C++, struct became optional.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!