Re: [PATCH v1 2/5] Teach git to optionally utilize a file system monitor to speed up detecting new or changed files.
- From
Ben Peart <peartben@gmail.com>
- Date
- May 17, 2017, 14:26 UTC
- Message-ID
- <0a3f38b7-788b-b364-3fef-83191e4b9bea@gmail.com>
- In-Reply-To
- <134ea57f-3a64-f7b5-67dd-8b14ff3cc04a@kdbg.org>
On 5/16/2017 3:13 PM, Johannes Sixt wrote:
Show 12 quoted lines
> Am 16.05.2017 um 19:17 schrieb Ben Peart: >> OK, now I'm confused as to the best path for adding a get_be64. This >> one is trivial: >> >> #define get_be64(p) ntohll(*(uint64_t *)(p)) > > I cringe when I see a cast like this. Unless you can guarantee that p is > char* (bare or signed or unsigned), you fall pray to strict aliasing > violations, aka undefined behavior. And I'm not even mentioning correct > alignment, yet. > > -- Hannes
Note, this macro is only used where the CPU architecture is OK with unaligned memory access. You can see it in context with many similar macros and casts in bswap.h. It's outside the scope of this patch series to fix them all. Perhaps a separate patch series?