[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: generic crypto - remarks
From: |
Jim Meyering |
Subject: |
Re: generic crypto - remarks |
Date: |
Fri, 21 Oct 2005 18:33:34 +0200 |
Bruno Haible <address@hidden> wrote:
> Simon Josefsson wrote:
>> > you don't need it,
>> > because the rules for struct layout in C guarantee that a structure field
>> > is aligned to a multiple of the alignment of the previous field.
>>
>> Are you saying that even if we don't change the type of buffer to
>> char, we don't need that alignment? I would agree, but I'm not
>> certain.
>
> If the previous struct element is a 'uint32_t' then a struct element of
> type char or char[] has the same alignment. You can rely on it, but it
> deserves a comment because it would break if someone inserts, say, a
> 'short' field in between.
Comment-only requirements can be overlooked.
Putting a compile-time assertion like the following,
right after the struct definition, adds some clout :-)
verify (offsetof (struct S, member_m) % 4 == 0);
Hmm... that assumes 8-bit bytes.
Does anyone know of existing systems, less than say
10 years old that have CHAR_BIT different from 8?
- generic crypto - remarks, Bruno Haible, 2005/10/21
- Re: generic crypto - remarks, Simon Josefsson, 2005/10/21
- Re: generic crypto - remarks, Bruno Haible, 2005/10/21
- Re: generic crypto - remarks, Paul Eggert, 2005/10/21
- Re: generic crypto - remarks, Simon Josefsson, 2005/10/22
- Re: [bug-gnulib] Re: generic crypto - remarks, Bruno Haible, 2005/10/22
- Re: generic crypto - remarks, Simon Josefsson, 2005/10/22
- Re: generic crypto - remarks, Jim Meyering, 2005/10/25
- Re: generic crypto - remarks, Paul Eggert, 2005/10/27
- Re: generic crypto - remarks, Simon Josefsson, 2005/10/22