Re: [PATCH] Re: [PATCH] Multi protocol support (stage #1)

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

 



Trent Piepho wrote:
On Fri, 19 May 2006, Manu Abraham wrote:
Trent Piepho wrote:
Why is there padding in both the xxxx_params structs, and in the union that
contains them?  Same for the xxxx_info structs and the union they are in.  If
you have the padding value in the union, the padding in each of the structs in
the union isn't necessary.

Well, it was a suggestion from Johannes. pad[32] and pad [128]

I think maybe that isn't what he meant.  Maybe Johannes can provide
reasoning why structures in a union and the union itself all need padding.

If you write a switch statement like this:
    switch(d) {
        case DVBFE_DELSYS_DVBS: return 1;
        case DVBFE_DELSYS_DSS: return 1;
        case DVBFE_DELSYS_DVBS2: return 1;
        case DVBFE_DELSYS_DVBC: return 1;
        case DVBFE_DELSYS_DVBT: return 1;
        case DVBFE_DELSYS_DVBH: return 1;
        case DVBFE_DELSYS_ATSC: return 1;
    }

You will get a warning message from gcc:
foo.c:14: warning: enumeration value 'DVBFE_DELSYS_DUMMY' not handled in switch

use default. That will not give you any warnings

If you do that, you will lose the ability of gcc to warn you if you forget
to handle a case.  I do not think the API should force application
programmers to use a certain style.  Obviously, someone likes this warning
or gcc wouldn't have it.


Obviously, you may clarify this at LKML ;-) No further comments




_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux