Jump to content
  • Advertisement

Archived

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

__fold

inline keyword in VS C++ 6

This topic is 5276 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
No. But you can use .inl files to achieve much the same effect.


/// A.h

#ifndef A_H
#define A_H

class A
{
public:
inline void foo();
};

#include "A.inl"
#endif




/// A.inl

void A::foo()
{
...
}



"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
One side note; you can specify the inline directive just in the .inl file, making your header files cleaner.

One tip; Here''s a technique that you will allow you to inline only in release mode saving precious debug compile time. This is especially useful for large projects. I know compilers usually don''t inline in debugmode anyway but they do have to parse all the .inl files which can be easily prevented.


/// A.h

#ifndef A_H
#define A_H

class A
{
public:
void foo();
};

#ifndef _DEBUG
#include "A.inl"
#endif

#endif




/// A.inl

inline void A::foo()
{
...
}

/// A.cpp

#include "A.h"

// Compile inline functions

#ifdef _DEBUG
#define inline
#include "A.inl"
#endif





-------
The problem with common sense is that it is never common.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!