[35] Miscellaneous environmental issues
(Part of C++ FAQ Lite, Copyright © 1991-2001, Marshall Cline, cline@parashift.com)


FAQs in section [35]:


[35.1] Is there a TeX or LaTeX macro that fixes the spacing on "C++"? UPDATED!

[Recently added a new LaTeX macro thanks to Bob Kline; rewrote (in 4/01) and wordsmithing thanks to Stan Brown (in 8/01). Click here to go to the next FAQ in the "chain" of recent changes.]

Yes.

Here are two LaTeX macros for the word "C++". They prevent line breaks between the C and "++", and the first packs the two "+"s close to each other but the second does not. Try them both and see which one you like best.

 \newcommand{\CC}{C\nolinebreak\hspace{-.05em}\raisebox{.4ex}{\tiny\bf +}\nolinebreak\hspace{-.10em}\raisebox{.4ex}{\tiny\bf +}}
 
 \def\CC{{C\nolinebreak[4]\hspace{-.05em}\raisebox{.4ex}{\tiny\bf ++}}}

Here are two more LaTeX macros for the word "C++". They allow line breaks between the C and "++", which may not be desirable, but they're included here just in case.

 \def\CC{C\raise.22ex\hbox{{\footnotesize +}}\raise.22ex\hbox{\footnotesize +}}
 
 \def\CC{{C\hspace{-.05em}\raisebox{.4ex}{\tiny\bf ++}}}

TopBottomPrevious sectionSearch the FAQ ]


[35.2] Are there any pretty-printers that reformat C++ source code? UPDATED!

[Recently fixed the URL for Artistic Style thanks to Claus Dahl; added A2PS thanks to Clark Dorman (in 4/01). Click here to go back to the beginning of the "chain" of recent changes.]

In alphabetical order:

Finally, you might consider lgrind which is another C++ to LaTeX translator (check for the closest mirror site of the ctan archive). The following is a grind definition for C++ (but this one doesn't recognize some new keywords such as bool or wchar_t, and it doesn't recognize a file ending with .cpp as C++):

 C++|c++|CC:\
    :pb=\p\d?\(:cf:np=\)\d?;:bb={:be=}:\
    :cb=/*:ce=*/:ab=//:ae=$:sb=":se=\e":lb=':\
    :zb=@:ze=@:tb=%%:te=%%:mb=%\$:me=\$%:vb=%\|:ve=\|%:\
    :le=\e':tl:id=_~\::\
    :kw=asm auto break case cdecl char continue default do double else\
    enum extern far float for fortran goto huge if int interrupt long\
    near pascal register return short signed sizeof static struct\
    switch typedef union unsigned while void\
    #define #else #endif #if #ifdef #ifndef #include #undef # define\
    endif ifdef ifndef include undef defined #pragma\
    class const delete friend inline new operator overload private\
    protected public template this virtual:

TopBottomPrevious sectionSearch the FAQ ]


[35.3] Is there a C++-mode for GNU emacs? If so, where can I get it?

Yes, there is a C++-mode for GNU emacs.

The latest and greatest version of C++-mode (and C-mode) is implemented in the file cc-mode.el. It is an extension of Detlef and Clamen's version. A version is included with emacs. Newer version are available from the elisp archives.

TopBottomPrevious sectionSearch the FAQ ]


[35.4] Where can I get OS-specific questions answered (e.g., BC++, DOS, Windows, etc)?

See one of the following:

TopBottomPrevious sectionSearch the FAQ ]


[35.5] Why does my DOS C++ program says "Sorry: floating point code not linked"?

The compiler attempts to save space in the executable by not including the float-to-string format conversion routines unless they are necessary, but sometimes it guesses wrong, and gives you the above error message. You can fix this by (1) using <iostream> instead of <cstdio>, or (2) by including the following function somewhere in your compilation (but don't call it!):

 static void dummyfloat(float *x) { float y; dummyfloat(&y); }

See the FAQ on stream I/O for more reasons to use <iostream> vs. <cstdio>.

TopBottomPrevious sectionSearch the FAQ ]


[35.6] Why does my BC++ Windows app crash when I'm not running the BC45 IDE?

If you're using BC++ for a Windows app, and it works OK as long as you have the BC45 IDE running, but when the BC45 IDE is shut down you get an exception during the creation of a window, then add the following line of code to the InitMainWindow() member function of your application (YourApp::InitMainWindow()):

 EnableBWCC(TRUE);


E-Mail E-mail the author
C++ FAQ LiteTable of contentsSubject indexAbout the author©Download your own copy ]
Revised Aug 15, 2001