Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1220056
| From | David Laight <David.Laight@ACULAB.COM> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [GIT] Networking |
| Date | 2015-09-07 13:10 +0200 |
| Message-ID | <q62tc-3L3-7@gated-at.bofh.it> (permalink) |
| References | (3 earlier) <q4HqO-37a-19@gated-at.bofh.it> <q4HAu-3ib-27@gated-at.bofh.it> <q4JVE-6Lq-3@gated-at.bofh.it> <q4Vaq-60u-21@gated-at.bofh.it> <q537Z-rj-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Rustad, Mark D
...
> >> static int smp_ah(struct crypto_blkcipher *tfm, const u8 irk[16],
> >> const u8 r[3], u8 res[3])
> >
> > Expect that it looks like you are passing arrays by value,
> > but instead you are passing by reference.
> >
> > Explicitly pass by reference and sizeof works.
>
> It depends on what you mean by works. It at least doesn't look so misleading when passing by reference
> and so works more as expected. The sizeof in either case will never return the size of the array. To
> have sizeof return the size of the array would require a typedef of the array to pass by reference. In
> some cases that could be the right thing to do.
Feed:
int bar(int (*f)[10]) { return sizeof *f; }
into cc -O2 -S and look at the generated code - returns 40 not 4.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [GIT] Networking Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-03 18:50 +0200
Re: [GIT] Networking David Miller <davem@davemloft.net> - 2015-09-03 19:50 +0200
Re: [GIT] Networking Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-03 20:30 +0200
Re: [GIT] Networking Joe Perches <joe@perches.com> - 2015-09-03 20:40 +0200
Re: [GIT] Networking Julia Lawall <julia.lawall@lip6.fr> - 2015-09-03 21:40 +0200
Re: [GIT] Networking Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-03 21:50 +0200
Re: [GIT] Networking Julia Lawall <julia.lawall@lip6.fr> - 2015-09-03 23:00 +0200
Re: [GIT] Networking Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-03 23:10 +0200
Re: [GIT] Networking Julia Lawall <julia.lawall@lip6.fr> - 2015-09-03 23:30 +0200
Re: [GIT] Networking Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-03 20:40 +0200
Re: [GIT] Networking Marcel Holtmann <marcel@holtmann.org> - 2015-09-03 23:10 +0200
RE: [GIT] Networking David Laight <David.Laight@ACULAB.COM> - 2015-09-04 11:10 +0200
Re: [GIT] Networking "Rustad, Mark D" <mark.d.rustad@intel.com> - 2015-09-04 19:40 +0200
RE: [GIT] Networking David Laight <David.Laight@ACULAB.COM> - 2015-09-07 13:10 +0200
Re: [GIT] Networking "Rustad, Mark D" <mark.d.rustad@intel.com> - 2015-09-08 19:00 +0200
Re: [GIT] Networking David Miller <davem@davemloft.net> - 2015-09-03 20:50 +0200
Re: [GIT] Networking Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> - 2015-09-05 18:20 +0200
csiph-web