Fix for makebuilder not opening properly files referenced by errors/warnings

Andreas Pakulat apaku at gmx.de
Sun Aug 17 08:34:41 UTC 2008


On 17.08.08 00:12:56, dizzy wrote:
> On Saturday 16 August 2008 23:26:09 Andreas Pakulat wrote:
> > >  private:
> > > +    MakeOutputModel const& m_model;
> >
> > That should be a pointer not a const&.
> 
> I have noticed that KDE code makes heavy usage of pointers and almost no usage 
> of references. I assume this has to do with the coding style or something else 
> I do not know of. Can you point me to an explanation (so I can be more careful 
> in the future, IMO references are a big plus of C++ over C since it provides 
> builtin syntax to express that a "pointer" cannot be NULL which is the main 
> usage of pointers in general, to be send as non NULL to achieve pass by 
> reference semantics).

Well, its kind of a "rule of thumb" to pass QObject's around via
pointer. And in fact now that I read it again, it might just be
'strange' to the qt-used eye :) So as long as it builds and works I
don't care too much wether its a pointer or a const-ref. 

> > >      QString errorText;
> > > +    QString currDir; // store current directory if relative path is
> > > stored in "file"
> >
> > Why not store the absolute path in file instead of a relative one, isn't
> > it used just for opening the file?
> 
> I've thought about this issue too. Basically the main reasoning was that the 
> user is expected to activate those items much less than they are generated (so 
> I only convert to absolute path on activation). I realise now this is somewhat 
> a stupid decision on my part, a user is to be expected to activate all 
> warnings/errors (or almost all) and it's not like that conversion saves a lot 
> of CPU (not like optimizing ActiveFilters::processAndCreate() regexp matching 
> which is on my todo list :) ). I'll change it to compute the absolute path at 
> item generation if that's fine.

Hmm, are you saying that the code does a QFileInfo::isRelative() check
each time you create a warning item (I should've read the patch a bit
closer)? In that case it might in fact be better to calculate it onlu
when the item is activated... 

Andreas

-- 
Truth will out this morning.  (Which may really mess things up.)




More information about the KDevelop-devel mailing list