Advertisement

Inlining accessors

Started by December 27, 2000 05:19 PM
0 comments, last by gimp 24 years ago
Posting a lot today huh? Does the following get inlined automatically? const unsigned char GetXRelative(void) const { return m_Xunits; } or would I need to specify the inline keyword to provide futher hinting to the compiler? Thanks
Chris Brodie
Depends where it is. If it''s inside a class declaration, then it''s called ''implicitly inlined'', and gets inlined automatically. If it''s a global function, then it''s up to the compiler. Using inline doesn''t ensure that it''ll be inlined, but it usually will be if the code is simple enough (no recursion or huge loops).

Morbo

This topic is closed to new replies.

Advertisement