[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/3] decrease visibility of local symbols
From: |
Dima Kogan |
Subject: |
Re: [PATCH 2/3] decrease visibility of local symbols |
Date: |
Sun, 26 Jan 2025 18:51:52 -0800 |
Keeping your symbols localized is general good hygiene, and has even
more upsides:
- The robot reader of the code (the compiler) gains a higher level of
understanding: it gets knowledge of the FULL list of callers of such a
function, and is free to make deep optimizations, like inlining the
function
- The human reader of the code also gains a higher level of
understanding. With local functions I also know about exactly what
paths are possible for calling them by simply doing a text search in
one file.
Relatedly, the linker visibility settings are controllable also (gcc
-fvisibility or attribute((visibility))), but that's important for
shared libraries, and less so for executables.
[PATCH 3/3] improve const correctness, Georg Sauthoff, 2025/01/26
Re: [PATCH 1/3] add missing include, Tim Rice, 2025/01/26