Re: Compiler Warnung

Philipp Thomas <[email protected]>
Newsgroups gmane.linux.suse.programming
Organization SUSE LINUX Products GmbH, G F: Markus Rex, HRB 16746 (AG Nürnberg)
Message-ID <[email protected]>
Hallo Sascha,

* Sascha 'saigkill' Manns ([email protected]) [20090316 17:43]:

> #else
>     return false;
> #endif
> } <- Das ist Zeile 358

Der Compiler kann nicht erkennen, das alle möglichen Fälle im switch
abgehandelt werden, also beschwert er sich, dass hier ein Verlassen der
Funktion ohne Rückgabewert möglich ist.

> Kann ich hier auch return false oder return 0 eingeben?
> Ich habe die cpp Datei mal angehangen...

Ich würde etwas weiter oben bei 

    case NoBattery:
         // we have no way to determine if we're on batteries,
         // so we say we aren't
        return false;

einfach noch default: hinzufügen:

    case NoBattery:
    default:
         // we have no way to determine if we're on batteries,
         // so we say we aren't
        return false;

Dann "sieht" der Compiler, das alle möglichen Fälle abgedeckt sind.

Philipp
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.