C
C programming
reference
comp.lang.c FAQ
perl script extracting struct declartions from C
source
to deal with large (>=2GB) files:
#define _LARGEFILE_SOURCE and #define _FILE_OFFSET_BITS 64
(prior #include <stdio.h>) and
use fseeko() and ftello() instead of
fseek() and ftell() respectively.
The GNU C
Library manual.
C++
STL doc:
[cgi.com]
[cplusplus.com]
comp.lang.c++ FAQ
(take with grain of salt!)
to get bits representation of double:
unsigned long* ulp = (unsigned long*)&n;
bitset<32> bits_less_signif (*ulp);
ulp++;
bitset<32> bits_most_signif (*ulp);
cout << bits_most_signif << bits_less_signif << endl;
gcc
- src (Icelandic GNU mirror)
- installation doc
- manual
-
C++ library doc at gnu.org
-
perl script determining which ld is used by gcc
(Solaris/SunOS)
-
to see (very verbose) linker output, use -Wl,-verbose option for gcc
-
to get a list of gcc predefined symbols (used for platform identification etc.):
gcc -E -dM - < /dev/null
-
to remove dynamic dependency on libgcc_s.so, compile with -static-gcc flag
-
-O3 seems to improve drastically (compared to -O2) the speed of C++ code
(and seems does not have much effect on C code)
gcc problems
-
if linking shared library and getting
ld: fatal: relocations remain against allocatable but non-writable sections
this means that one tries to link into shared library non-pic objects;
those objects should be (re)compiled with -fpic or -fPIC options
(observed on Solaris)
-
if getting weird craches upon exit from C library, recompile gcc with
--enable-__cxa_atexit option (relevant on Linux only).
-
if getting weird unresolved symbols like _ZNSs4_Rep20_S_empty_rep_storageE at
runtime, try to (re)compile against static libstdc++.
-
a run-time error undefined symbol: __dso_handle caused by incompatibility
between gcc and binutils, and triggered in presence of some specific gcc flags
(notably -nostdlib). Upgrade to the latest binutils
(from the gcj FAQ).
-
if having inconsistent floating point results, or other floating point issues,
the option -ffloat-store may help; for details, see links at the
relevant portion
of gcc docs.
-
error expected ')' before string constant (usually in old code)
probably caused by code like
printf (__FUNCTION__" bla-bla");
in old gcc's (prior 3.4?), __FUNCTION__ was a string literal,
and in recent gcc's it is a variable; so this code should be replaced by
printf ("%s bla-bla", __FUNCTION__)
created Mar 24 2006
last updated Fri Sep 19 21:49:22 GMT 2008