Questions: Difference between revisions

No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
Some questions I've pondered, and my answers, which may or may not be correct.
Some questions I've pondered, and my answers, which may or may not be correct. This stuff didn't seem to fit anywhere else at the time.


==UNIX==
==UNIX==
Line 18: Line 18:


*Q: Why doesn't <tt>du</tt> take an -i argument for inode usage?
*Q: Why doesn't <tt>du</tt> take an -i argument for inode usage?
*A: It's difficult (and impossible for regular users) to map directory hierarchies to inodes.
*A1: It's difficult (and impossible for regular users) to map directory hierarchies to inodes.
*A2: Newer versions of <tt>util-linux</tt> <i>do</i> support <tt>--inodes</tt> as an argument to <tt>du</tt>!
===Linux===
===Linux===
*Q: How can I discover a module's parameters?
*Q: How can I discover a module's parameters?
Line 25: Line 26:
*Q: How do I remove an obsolete broken package from Debian upon getting the error "This might mean you need to manually fix this package"?
*Q: How do I remove an obsolete broken package from Debian upon getting the error "This might mean you need to manually fix this package"?
*A: <tt>dpkg --force-remove-reinstreq --remove pkgname</tt>
*A: <tt>dpkg --force-remove-reinstreq --remove pkgname</tt>
*Q: How can I search for <tt>string</tt> in package descriptions on [[Debian]]?
*A: <tt>aptitude search '~dstring'</tt> (among other ways)
*Q: Where does <tt>pkg-config</tt> look for .pc files on this system?
*A: <tt>pkg-config --variable pc_path pkg-config</tt>
===[[X]]===
===[[X]]===
*Q: How do I get a list of all a display's clients?
*Q: How do I get a list of all a display's clients?
Line 34: Line 42:
==[[C]]==
==[[C]]==
*Q: Why aren't ''"target"''-style <tt>#includes</tt> a good idea with any sane compiler?
*Q: Why aren't ''"target"''-style <tt>#includes</tt> a good idea with any sane compiler?
*A: So long as you can append to the default include search path (ie, the <tt>-I</tt> option to [[gcc]]), the ''&lt;target&gt;''-style include can search in your project directory. Building from the source toplevel, a simple <tt>-I.</tt> added to CFLAGS allows #include &lt;toplevel/relative/filename&gt;. Moved headers will trigger a preprocessing failure. If ''"target"''-style <tt>#includes</tt> are used, the directory of the source being compiled is typically searched prior to other include paths. This means moving source files or introducing new headers can change the files being included, which is almost always undesirable.
*A: So long as you can append to the default include search path (ie, the <tt>-I</tt> option to [[gcc]]), the ''&lt;target&gt;''-style include can search in your project directory. Building from the source toplevel, a simple <tt>-I.</tt> added to CFLAGS allows <tt>#include <toplevel/relative/filename></tt>. Moved headers will trigger a preprocessing failure. If ''"target"''-style <tt>#includes</tt> are used, the directory of the source being compiled is typically searched prior to other include paths. This means moving source files or introducing new headers can change the files being included, which is almost always undesirable.
===[[GCC]]===
===[[GCC]]===
*Q: How do I see which optimization flags are enabled with -Ox?
*Q: How do I see which optimization flags are enabled with -Ox?
*A: Check the info pages, or use -Q -Ox --help=optimizers.
*A: Check the info pages, or use -Q -Ox --help=optimizers.
*Q: How do I see what's turned on by <tt>-march=native</tt>?
*A: Run <tt>gcc -march=native -v -Q --help=target</tt>
==[[C++]]==
*Q: How do I get [[CMake]] to print output from my googletests?
*A: Run <tt>make test ARGS=-V</tt>