On Mon, Jun 30, 2014 at 08:54:52PM +0200, Markus Teich wrote:
> Heyho,
>
> since I did not find any suckless project regarding this issue, I would like
> to
> ask you guys for some feedback:
>
>
> unsigned char *msg;
> size_t msg_size;
> struct foo *msg_data;
> struct bar *msg_signature;
>
> m
On Tue, Jul 1, 2014 at 8:01 AM, Markus Teich wrote:
> Rob wrote:
>> You've got alignment issues here - msg will be aligned to support any
>> type (as malloc's interface specifies) so msg+1 will most likely be on
>> an odd address, one byte off a highly aligned address. This means if
>> your struct
On Tue, Jul 01, 2014 at 05:01:43PM +0200, Markus Teich wrote:
> Rob wrote:
> > You've got alignment issues here - msg will be aligned to support any
> > type (as malloc's interface specifies) so msg+1 will most likely be on
> > an odd address, one byte off a highly aligned address. This means if
>
Rob wrote:
> You've got alignment issues here - msg will be aligned to support any
> type (as malloc's interface specifies) so msg+1 will most likely be on
> an odd address, one byte off a highly aligned address. This means if
> your struct contains anything other than chars, you'll have UB. This i
On Tue, Jul 01, 2014 at 01:56:04PM +0200, Markus Teich wrote:
> struct msg_signed_data {
> unsigned int op;
> struct foo data;
> struct bar signature;
> };
If this is data that goes across the network then instead of
directly mapping a struct on that data I'd simply have function
On Tue, Jul 1, 2014 at 2:56 PM, Markus Teich wrote:
> thanks for your feedback. What about declaring a struct for each message-type:
>
> struct msg_signed_data {
> unsigned int op;
> struct foo data;
> struct bar signature;
> };
>
> This should also solve the alignment issu
Rob wrote:
> You've got alignment issues here - msg will be aligned to support any
> type (as malloc's interface specifies) so msg+1 will most likely be on
> an odd address, one byte off a highly aligned address. This means if
> your struct contains anything other than chars, you'll have UB. This i
See also: https://kentonv.github.io/capnproto/
On 30/06/14, Markus Teich wrote:
Heyho,
Hello there,
since I did not find any suckless project regarding this issue, I
would like to ask you guys for some feedback:
unsigned char *msg;
size_t msg_size;
struct foo *msg_data;
struct bar *msg_signature;
msg_size = sizeof(unsigned char)
Heyho,
since I did not find any suckless project regarding this issue, I would like to
ask you guys for some feedback:
unsigned char *msg;
size_t msg_size;
struct foo *msg_data;
struct bar *msg_signature;
msg_size = sizeof(unsigned char)// op
+ sizeof(struct foo)// data
10 matches
Mail list logo