small patch

Paulo Moura Guedes moura at kdewebdev.org
Thu Mar 10 20:03:04 UTC 2005


On Thursday 10 March 2005 16:05, you wrote:
> On Thursday 10 March 2005 16:41, Paulo Moura Guedes wrote:
> > On Thursday 10 March 2005 00:42, Bernd Schubert wrote:
> > > The B. Stroustrup C++ book is in front of me, clearly stating that one
> > > shouldn't uses macros in C++. Thinking about it and having programmed
> > > the hole week in C, I believe its the most efficient way using this
> > > small macro for it...
> >
> > How about:
> > const char* PROFILEDIR = "kdevelop/profiles/";
> > ;)
>
> Well, correct me if I'm wrong, but won't this use memory while defining a
> constant with #define won't use additional memory for an additional
> variable? Of course, one could hope that the compiler will recognize and
> optimize it. I certainly considered this, but this is really one of the
> points I don't agree in with B. Stroustrup .

You can have:
const char PROFILEDIR[] = "kdevelop/profiles/";
This way you don't need a pointer in each compile unit.
BTW, have you already heard "early optimization is the root of all evil"? :)
-- 
Paulo Moura Guedes

Linux Caixa Mágica  - http://caixamagica.org
KDE Web Development - http://kdewebdev.org




More information about the KDevelop-devel mailing list