KDE_ macros in kde_file.h

Jaroslaw Staniek js at iidea.pl
Tue Oct 10 09:14:54 BST 2006

Jaison Lee said the following, On 2006-10-10 00:14:

>> On Monday 09 October 2006 20:35, Jaison Lee wrote:
>> > Most of the KDE_* macros defined in kde_file.h (KDE_mkdir, KDE_open,
>> > KDE_rename, KDE_stat, etc.) are not used at all, and those that are
>> > are used sparingly (sometimes by only one class/function).
>> They are very much used AFAICS... E.g. KDE_open is used in the 
>> following files:
> 6 files out of ~1500 (in kdelibs) is "very much used" to you?  :)  How
> can you justify that? (And BTW: update your kdelibs; one of those
> isn't using it anymore :P )

An alternative is to add an #ifdef in every place where KDE_* macro was used.

It's not about number of places where they are used, but importance of them. 
There are places in KDE where using lower-level OS functions is important. The 
code (being a result of using of these macros) is called very often.
Moreover any future code in KDE (core or additional) where we want to use 
native interfaces instead of these from Qt (e.g. to avoid additional 
allocations) will benefit from the macros. It's also a matter of moving 
#ifdefs out.

This idea first come when KDElibs/mac/win32 ports were prepared.

And BTW: the set of macros is complete for... compeltness. By removing one of 
them now you won't get any optimization in the resulting binaries and a day 
may come when a developer will define his private macro doing the same in his 
low-level code. (kde_file.h is installed as a public header to avoid that).

regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice: http://www.kexi-project.org, http://www.koffice.org
  KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org

More information about the kde-core-devel mailing list