Paste number 150153: sizeof & padding

Index of paste annotations: 1

Paste number 150153: sizeof & padding
Pasted by: remi`bd
When:6 years, 10 months ago
Share:Tweet this! | http://paste.lisp.org/+37UX
Channel:None
Paste contents:
Raw Source | XML | Display As
#include <stdio.h>
#include <stddef.h>

#define alignof(type) __alignof__(type)

struct foo {
  char *bar;
  unsigned int baz;
};

int
main(void) {
  printf("sizeof(foo) = %zd\talignof(foo) = %zd\n",
	 sizeof(struct foo), alignof(struct foo));
  return 0;
}

Annotations for this paste:

Annotation number 1: Output
Pasted by: remi`bd
When:6 years, 10 months ago
Share:Tweet this! | http://paste.lisp.org/+37UX/1
Paste contents:
Raw Source | Display As
$ ./sizes
sizeof(foo) = 16        alignof(foo) = 8

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.