Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C++
Expertise: All
Jun 16, 2000

Making Inline Functions Compatible With C Compilers

A global function may be declared inline. If you use the same function in different development environments, e.g., C and C++, you can hide the "inline" keyword from a C compiler while keeping it visible to a C++ compiler like this:

 
#ifndef __cplusplus
#define inline
#endif

The preprocessor directives make sure that only a C++ compiler sees the inline keyword:

 
inline int get_dst() {return dst; }// inline not seen by C
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap