Question about trunk sample includes, should <> be used instead of ""

Tim Stahlhut stahta01 at verizon.net
Sat Feb 2 17:16:44 PST 2008


Vadim Zeitlin wrote:

> On Sat, 02 Feb 2008 08:35:12 -0500 Tim S <stahta01 at netzero.com> wrote:
>
> TS> I have an question about trunk sample code includes, should <> be used 
> TS> instead of "" in the #include section like in case of below?
>
>  No because I believe some compilers wouldn't then take these headers into
> account when creating dependencies information (although this isn't the
> case when using g++, even though we use -MMD and not -MD, I wonder why...)
> and while this is usually just what you need when you write applications
> using wx, it wouldn't be convenient for the samples which are also used to
> test it by us and so we do want them to be recompiled when wx headers
> change.
>
> TS> I have an idea that replaces the include of wx/wx.h with a new header of 
> TS> wx_forward.h an header that does forward declarations of wxWidgets 
> TS> classes.
>
>  Could you please explain a bit better what exactly do you intend to do?
> The idea as stated doesn't seem to be worth pursuing to me: while forward
> declarations should be used by "real" programs, most samples intentionally
> include wx/wx.h just because this keeps them simple and we don't want to
> complicate them unnecessarily.
>
> TS> And, I think it might be a good idea to change the quotes to 
> TS> square brackets at the same time.
>
>  No, definitely not, it's not a good idea to do 2 changes at once.
>
>  Thanks,
> VZ

I think, I understand. My changes are not good from a maintence point of
view.

I am still going to work on a single header file that contains class
forward declares on the classes defined by wx/wx.h.

I am working on the file with current working name of wx/wx_forward.h

The top of the file looks like this; I still need to verify that I have
not included classes not in wx/wx.h and wx/wxprec.h

Tim S

#ifndef WX_FORWARD_H
#define WX_FORWARD_H

#include <wx/defs.h>

/*

// Example use of this header
#include <wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx_forward.h>   // forward declarations of wxWidgets classes
#endif  // WX_PRECOMP

*/

// Only add forward declarations of classes included by wxprec.h
// List the header that defines the class in comments.

// Add classes in A-Z order

class WXDLLIMPEXP_FWD_ADV  wxAboutDialogInfo;       // #include <wx/aboutdlg.h>
class WXDLLIMPEXP_FWD_CORE wxActivateEvent;         // #include <wx/event.h>
class WXDLLIMPEXP_FWD_CORE wxApp;                   // #include <wx/app.h>
class WXDLLIMPEXP_FWD_BASE wxArrayString;           // #include <wx/arrstr.h>
class WXDLLIMPEXP_FWD_CORE wxBoxSizer;              // #include <wx/sizer.h>
class WXDLLIMPEXP_FWD_CORE wxButton;                // #include <wx/button.h>
class WXDLLIMPEXP_FWD_CORE wxBrush;                 // #include <wx/brush.h>
class WXDLLIMPEXP_FWD_CORE wxCheckBox;              // #include <wx/checkbox.h>
class WXDLLIMPEXP_FWD_CORE wxChoice;                // #include <wx/choice.h>
class WXDLLIMPEXP_FWD_CORE wxClientDC;              // #include <wx/dcclient.h>
class WXDLLIMPEXP_FWD_CORE wxColour;                // #include <wx/colour.h>







More information about the wx-dev mailing list