compiler warnings

André Wöbbeking Woebbeking at onlinehome.de
Thu Mar 31 19:24:16 BST 2005


Hi,

I know that from time to time someone suggests to cleanup all compiler 
warnings and I can only second that. For example I found these two 
goodies (warning: 'foo' might be used uninitialized in this function):

kdebase/kicker/applets/clock/clock.cpp:1626

        bool showDate = showDate || (zone->zoneIndex() != 0);

        if (!showDate && !showDayOfWeek)

One additional note, showDate is also a member variable. But AFAIK only 
the local variable is used in this example otherwise you've to use 
this->showDate. -Wshadow would be nice for this kind of things, but Qt 
prevents us from using it :-(



kwin/clients/modernsystem/modernsys.cpp: 219

    bool showh;
    int hsize, hwidth, bwidth, theight;

    KConfig c("kwinmodernsysrc");
    c.setGroup("General");
    show_handle = c.readBoolEntry("ShowHandle", true);

    hwidth = c.readUnsignedNumEntry("HandleWidth", 6);
    hsize = c.readUnsignedNumEntry("HandleSize", 30);
    if (!(showh && hsize && hwidth)) {
        showh = false;
        hwidth = hsize = 0;
    }

I think it should read

    showh = c.readBoolEntry("ShowHandle", true);



I know that most warnings are just warnings but sometimes they help 
finding errors. But if there're hundreds of warnings you'll oversee the 
important ones easily. Most warnings in kdelibs and kdebase exist for 
month now and IMO at least KDE core should be cleaned up.


Cheers,
André




More information about the kde-core-devel mailing list