Skip to main content
GameDev.net gamedev.net
🔒 Locked

quick question about inlining

Started by Kyo Aug 10, 2002 at 8:49 AM 2 replies 200+ views
Original Post
Kyo
Kyo
If I inline a function in a class which modifies a private variable, will it still work? I think i remember seeing that inlining replaces the function call with the code in the function directly so if it does replace the function call code in the main application it won''t be able to modify the private data of the class.
SabreMan
SabreMan
You''re getting confused. An inline expansion of a function means that, when machine code is generated for your program, the code for the function is expanded at the call-site rather than having a call to the function inserted at the call-site. The compiler will take care of public / private access rights at compile-time and ensure they always mean the same thing from the programmer''s point of view. So, yes, your class''s access modifiers will work regardless of whether a function is inlined or not.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.