Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

new wxWidget(wxSmith) project

<< < (4/6) > >>

Biplab:

--- Quote from: byo on June 23, 2007, 01:48:50 pm ---Hmm, I was just wondering - there's this _BORLANDC_ stuff inside wx_pch.h file:

--- End quote ---

I missed it. :)


--- Quote from: byo on June 23, 2007, 01:48:50 pm ---So it should work correctly. And it really cleans the source. Maybe with one exception: the "// put here all your rarely-changing header files" content should be placed before _BORLANDC_ stuff to cache rarely-changing project headers too. The only problem with wxSmith is that this "wx_pch.h" is not included for newly created resources but I'll probably try to detect such file and add it automatically.

--- End quote ---

This is a good idea. Or you may keep an option to specify the header file name (similar to wx_pch.h) which wxSmith will use. That'd be an easy option to implement.

"// put here all your rarely-changing header files" has to be pulled up if we want to support PCH for BCC. ;)

But AFAIK, newer BCC (Turbo C++ Explorer 2006's compiler) supports PCH creation using a Header file. :) So that bad hack is necessary only for BCC 5.5.

Other supported GUI builder, wxFormBuilder generates it's own source which will have that pragma. So I would not clean up code for that. :)

But definitely the clean-up would be good for wxSmith and w/o any gui builder.

Regards,

Biplab

killerbot:
ok , so now we know why that __BORLANDc__ thing is needed.

Well, it's a decision then to support Borland with pch or not.

But keep the following in mind. Say the some other compilers (Digital Mars or whatever) also need special stuff for pch in the code, then we can end up with a list of such #ifdef do whatever is needed in here for that specifi compiler #endif structures, and that will make the code less easier to read.
My point of view on this is, first we should have standard compliant code, so it's as portable as can be. Pch is not part of the standard (I think), that's why I am stressing on the point to do includes correct, because then you at least have correct standard code.
CB code has decided to use the pch feature of GCC, and therefor you find things like :

--- Code: ---#include "the pch header"
#ifndef CB_PRECOMP
blablabla
#endif
more blablabla

--- End code ---
where blablabla and more blablabl is header inclusion directives.

So, support BorlandC : yes or no. CB sources itself *only* support gcc, so in CB sources that Borland stuff is ready to go out of the door.

When you want to enable Borland pch, it is sufficient to do it in that pch header (sdk.h), and for pch support that header should be included first. And then the blablabla stuff.
I think wx pch header probably does similar thing, so also that points that it is not needed to do in our sources or wizard generated sources.

Oh, new post already before this one is ready, with interesting information :

--- Quote ---But AFAIK, newer BCC (Turbo C++ Explorer 2006's compiler) supports PCH creation using a Header file. So that bad hack is necessary only for BCC 5.5.
--- End quote ---

Bye bye BCC5.5 ;-)

When a user is creating a bigger project starting from the wizards code, it can happen he wants to to pch stuff with his code, well that's the users choice, I feel that the code generated from our wizards should NOT take that into account. We can not, and should not, predict all possible uses or ideas a user might have in mind.

Biplab:

--- Quote from: killerbot on June 23, 2007, 02:31:42 pm ---So, support BorlandC : yes or no. CB sources itself *only* support gcc, so in CB sources that Borland stuff is ready to go out of the door.

--- End quote ---

As I wrote earlier, you can't compile C::B with BCC 5.5.1 as it fails to compile Squirrel. I have a partial makefile which I can give you in case you want to try.


--- Quote from: killerbot on June 23, 2007, 02:31:42 pm ---Bye bye BCC5.5 ;-)

--- End quote ---

We may need to say bye bye to this little compiler. Turbo package is full of S**t. You've to install the whole IDE + .NET SDK 1.1 to get the compiler working for you. :x


--- Quote ---When a user is creating a bigger project starting from the wizards code, it can happen he wants to to pch stuff with his code, well that's the users choice, I feel that the code generated from our wizards should NOT take that into account. We can not, and should not, predict all possible uses or ideas a user might have in mind.
--- End quote ---

It's the most probable case that the user will use his/her own header file. We're just providing a basic framework. Now it's the user who'd take the final decision. :)

Regards,

Biplab

killerbot:

--- Quote ---Turbo package is full of S**t. You've to install the whole IDE + .NET SDK 1.1 to get the compiler working for you.
--- End quote ---

Darn right, I hope one day, they will provide just the compiler tools.

byo:
One thing also bothers me abotu this wx_pch.h file. There's code:


--- Code: ---#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

--- End code ---

which I think is wrong because valid source using pch should look like this:


--- Code: ---#include "wx_pch.h"

#ifndef WX_PRECOMP
// Include headers that are inside pch, may be even #include <wx/wx.h>
#endif
// Include headers that are not inside pch

--- End code ---

So actually the code I've pointed out from wx_pch.h should be put into sources (actually currently such non-pch source is in both wx_pch.h and source files). So the content of wx_pch.h proposed by me is:


--- Code: ---#ifndef WX_PCH_H_INCLUDED
#define WX_PCH_H_INCLUDED

// basic wxWidgets headers
#include <wx/wxprec.h>

#ifdef WX_PRECOMP
// put here all your rarely-changing header files
#endif // WX_PRECOMP

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#endif // WX_PCH_H_INCLUDED

--- End code ---

That may speed-up non-pch builds since in most cases not all <wx/wx.h> is included but only those headers that are really required. And from what I've seen, currently it's done by some trick like:


--- Code: ---#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif

--- End code ---

So the #ifdef..#endif guard is not needed at all since wx_pch.h won't do anything when pch-s are not enabled


BYO

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version