File: wx16.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (72 lines) | stat: -rw-r--r-- 2,905 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<HTML>
<head><title>C++ issues</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="topic13"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx9.htm#multiplat"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx15.htm#topic12"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx17.htm#topic18"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>C++ issues</H2>
<P>
The following documents some miscellaneous C++ issues.<P>
<A HREF="#topic14">Templates</A><BR>
<A HREF="#topic15">RTTI</A><BR>
<A HREF="#topic16">Type of NULL</A><BR>
<A HREF="#topic17">Precompiled headers</A><BR>
<P>

<HR>
<A NAME="topic14"></A>
<H3>Templates</H3>
<P>
wxWindows does not use templates since it is a notoriously unportable feature.<P>

<HR>
<A NAME="topic15"></A>
<H3>RTTI</H3>
<P>
wxWindows does not use run-time type information since wxWindows provides
its own run-time type information system, implemented using macros.<P>

<HR>
<A NAME="topic16"></A>
<H3>Type of NULL</H3>
<P>
Some compilers (e.g. the native IRIX cc) define NULL to be 0L so that
no conversion to pointers is allowed. Because of that, all these
occurences of NULL in the GTK port use an explicit conversion such 
as<P>
<FONT SIZE=2>
<PRE>
  wxWindow *my_window = (wxWindow*) NULL;
</PRE>
</FONT><P>
It is recommended to adhere to this in all code using wxWindows as
this make the code (a bit) more portable.<P>

<HR>
<A NAME="topic17"></A>
<H3>Precompiled headers</H3>
<P>
Some compilers, such as Borland C++ and Microsoft C++, support
precompiled headers. This can save a great deal of compiling time. The
recommended approach is to precompile <TT>"wx.h"</TT>, using this
precompiled header for compiling both wxWindows itself and any
wxWindows applications. For Windows compilers, two dummy source files
are provided (one for normal applications and one for creating DLLs)
to allow initial creation of the precompiled header.<P>
However, there are several downsides to using precompiled headers. One
is that to take advantage of the facility, you often need to include
more header files than would normally be the case. This means that
changing a header file will cause more recompilations (in the case of
wxWindows, everything needs to be recompiled since everything includes <TT>"wx.h"</TT>!)<P>
A related problem is that for compilers that don't have precompiled
headers, including a lot of header files slows down compilation
considerably. For this reason, you will find (in the common
X and Windows parts of the library) conditional
compilation that under Unix, includes a minimal set of headers;
and when using Visual C++, includes <TT>wx.h</TT>. This should help provide
the optimal compilation for each compiler, although it is
biassed towards the precompiled headers facility available
in Microsoft C++.<P>

</BODY></HTML>