[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1409839892.26422.115.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Thu, 04 Sep 2014 07:11:32 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Hannes Frederic Sowa <hannes@...essinduktion.org>
Cc: Denis Kirjanov <kirjanov@...il.com>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Daniel Borkmann <dborkman@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Denis Kirjanov <kda@...ux-powerpc.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Markos Chandras <markos.chandras@...tec.com>,
Martin Schwidefsky <schwidefsky@...ibm.com>
Subject: Re: [PATCH v2 net-next] net: filter: export pkt_type_offset() helper
On Thu, 2014-09-04 at 15:40 +0200, Hannes Frederic Sowa wrote:
> The type does not matter at all. Actually I wanted to use an empty
> struct but was afraid it might not work on older compilers and didn't
> want to check that with each version.
It matters. Really.
$ cat try.c
#include <stdio.h>
struct S_int {
char a;
int offset[0];
char b:1;
};
struct S_char {
char a;
char offset[0];
char b:1;
};
int main()
{
printf("sizeof(S_int) %zu\n", sizeof(struct S_int));
printf("sizeof(S_char) %zu\n", sizeof(struct S_char));
return 0;
}
$ gcc -o try try.c && ./try
sizeof(S_int) 8
sizeof(S_char) 2
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists