[sane-devel] coolscan2 in 1.0.8
Frank Zago
fzago at greshamstorage.com
Sun Apr 14 22:20:19 BST 2002
Hi Andreas,
> > You should also remove the default case in the switch (interface)
> > in cs2_open() and enumerates all the cases instead. gcc will warn if
> > there is some missing cases.
>
> I've done that, but what is the reason for this? Why shouldn't I use
> default instead of CS2_INTERFACE_UNKNOWN, which in all but one case
> would lead to an error anyway?
When a switch is done on an "enum" type, gcc can tell if one is missing in
the switch. Adding a default: defeat its purpose.
> > same function, if sp is NULL, s is always leaked.
>
> No, because cs2_close() is called.
Right.
It looks better now.
Frank.
More information about the sane-devel
mailing list