permission: move PrintTree into unnamed namespace#48874
permission: move PrintTree into unnamed namespace#48874nodejs-github-bot merged 1 commit intonodejs:mainfrom
Conversation
This function is not declared outside of fs_permission.cc and thus should not be visible outside the file during the linking stage.
|
Review requested:
|
RafaelGSS
left a comment
There was a problem hiding this comment.
LGTM. Would you mind explaining the current problem? Just to not make the same mistake again
|
@RafaelGSS Of course :) When building a C++ application, each compilation unit (e.g., As a rule of thumb, the visibility of symbols during the compilation phase should match the visibility of symbols during the linking phase. In this case, for example, This can lead to subtle bugs. (I'll ignore name mangling in this section.)
Moving a function into an anonymous namespace within a compilation unit ensures that it will not be visible outside of the compilation unit during the linking phase. (In most cases, the same can be accomplished by marking the function as Properly managing visibility has other benefits, too. For example, you might want to get a compiler warning if a function is unused. However, if a function is not in an anonymous namespace and not marked as |
|
Thank you! |
debadree25
left a comment
There was a problem hiding this comment.
Thank you much for explaining so well @tniessen :-)
|
Landed in 88ab2e7 |
This function is not declared outside of fs_permission.cc and thus should not be visible outside the file during the linking stage. PR-URL: nodejs#48874 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
This function is not declared outside of fs_permission.cc and thus should not be visible outside the file during the linking stage. PR-URL: nodejs#48874 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
This function is not declared outside of fs_permission.cc and thus should not be visible outside the file during the linking stage. PR-URL: nodejs#48874 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
This function is not declared outside of fs_permission.cc and thus should not be visible outside the file during the linking stage. PR-URL: nodejs#48874 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
This function is not declared outside of fs_permission.cc and thus should not be visible outside the file during the linking stage. PR-URL: nodejs#48874 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
This function is not declared outside of fs_permission.cc and thus should not be visible outside the file during the linking stage. PR-URL: nodejs#48874 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
This function is not declared outside of fs_permission.cc and thus should not be visible outside the file during the linking stage. PR-URL: #48874 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
This function is not declared outside of
fs_permission.ccand thus should not be visible outside the file during the linking stage.