Re: How to fix warning 'control reaches end of non-void function'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello ,

You can add a return statement at the end , even if control never reaches there.
It is interesting to know what is the standard way of avoiding this warning?

Daniel.

On Tue, Jul 29, 2008 at 10:17 PM, Alexander Beregalov
<a.beregalov@xxxxxxxxx> wrote:
> Hi
>
> What is it a right way to fix these warnings?
>
> smth function()
> {
>        switch (var) {
>        case one:
>                return 1;
>        default:
>                BUG();
>        }
> }
>
> warning: control reaches end of non-void function
>
> Thanks!
>
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux