Darryl Gove's blog
Debugging C++ with dbx
Here's the page on how to debug C++ exceptions using dbx. It omits my often repeated mantra about the -g flag. For C++ -g currently turns off 'front-end' inlining. This usually results in a significant loss in performance, but a benefit in the code being easier to read without the inlining. If you are interested in debugging the same code that you get without -g, or the faster code that does having inlining, then use the flag -g0 when building the application.
Posted at 08:51PM Mar 26, 2008 by Darryl Gove in Sun |
-xalias_level in C and C++
The compiler flag -xalias_level takes various options, and specifies the amount of aliasing that the compiler should assume. For example -xalias_level=any (the default at optimisation levels below -fast) means that the compiler should assume that any pointers may alias (ie point to the same location in memory).
In Sun Studio the available levels have different names for C and C++. adopted the C levels for both C and C++. The following table shows the mapping between the C and C++ names:
| C | C++ |
|---|---|
| any | any |
| basic | simple |
| weak | N/A |
| layout | compatible |
| strict | N/A |
| std | N/A |
| strong | N/A |
Posted at 04:28PM Jan 24, 2008 by Darryl Gove in Sun |
Mixed language development
Sometimes applications contain a mix of languages. For example, part in C and part in Fortran. This can require different libraries to be linked in depending on the support that the language requires. The general rule for mixed language linking is found in the documentation. The rule is link with the C++ compiler if the code contains C++, if not, link with the fortran compiler (obviously if the code is pure C, then link with the C compiler.). An exception to this is making a C library which uses C++ inside, where it is possible to link using the C compiler, specifying appropriate flags.
Posted at 09:12AM Nov 09, 2007 by Darryl Gove in Sun |
