• Advertisement

Archived

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

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

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