On Wednesday 06 November 2002 6:25 pm, Lars Gullik Bjønnes wrote:
> Angus Leeming <[EMAIL PROTECTED]> writes:
> | On Wednesday 06 November 2002 5:13 pm, Lars Gullik Bjønnes wrote:
> >> use a switch:
> |
> | If I do that I get a (spurious) warning:
> |
> | cxx: Warning: ../../../../src/frontends/controllers/biblio.C, line 365:
> | #117-D missing return statement at end of non-void function
> |           "biblio::searchKeys"
> |
> | ummm....
> |
> | This compiles cleanly. Ok now?
>
> eh, no.
>
> the default should go away.
>
> is it enough to have the assert on its own at the bottom? but comment
> why it is there.

Actually, the warning does not go away (no return statement, compiler doesn't 
know that Assert exits...)

Either I have
        if (type == x) {
                ...
                return a;
        } else { // type ==y
                ...
                return b;
        }
}

or I have
        if (type == x) {
                ...
                return a;
        }

        ...
        return b;
}

or I have
        switch (type) {
        case x
                ...
                return a;
        case y:
        default:
                ....
                return b;
        }

Those are the (only) choices I'm giving you ;-) Which do you prefer?

Anyway, as André points out, this is all academic because the "simple" search 
is a subset of the regex. I'll just remove that option.

Angus

Reply via email to