xref: /freebsd/share/man/man3/offsetof.3 (revision 580dbd65749a2caa4aa57e85e749b50c11f99284)
1799a00c0SKevin Lo.\"	$OpenBSD: offsetof.3,v 1.2 2010/02/18 18:30:19 jmc Exp $
2799a00c0SKevin Lo.\"
3799a00c0SKevin Lo.\" Copyright (c) 2010 Thomas Pfaff <tpfaff@tp76.info>
4799a00c0SKevin Lo.\"
5799a00c0SKevin Lo.\" Permission to use, copy, modify, and distribute this software for any
6799a00c0SKevin Lo.\" purpose with or without fee is hereby granted, provided that the above
7799a00c0SKevin Lo.\" copyright notice and this permission notice appear in all copies.
8799a00c0SKevin Lo.\"
9799a00c0SKevin Lo.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10799a00c0SKevin Lo.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11799a00c0SKevin Lo.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12799a00c0SKevin Lo.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13799a00c0SKevin Lo.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14799a00c0SKevin Lo.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15799a00c0SKevin Lo.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16799a00c0SKevin Lo.\"
17799a00c0SKevin Lo.\" $FreeBSD$
18799a00c0SKevin Lo.\"
19799a00c0SKevin Lo.Dd February 18 2010
20799a00c0SKevin Lo.Dt OFFSETOF 3
21799a00c0SKevin Lo.Os
22799a00c0SKevin Lo.Sh NAME
23799a00c0SKevin Lo.Nm offsetof
24799a00c0SKevin Lo.Nd offset of a structure member
25799a00c0SKevin Lo.Sh SYNOPSIS
26*580dbd65SJoel Dahl.In stddef.h
27799a00c0SKevin Lo.Ft size_t
28799a00c0SKevin Lo.Fn offsetof "type" "member"
29799a00c0SKevin Lo.Sh DESCRIPTION
30799a00c0SKevin LoThe
31799a00c0SKevin Lo.Fn offsetof
32799a00c0SKevin Lomacro expands to an integer constant expression of type
33799a00c0SKevin Lo.Ft size_t
34799a00c0SKevin Loand yields the offset,
35799a00c0SKevin Loin bytes, of the field
36799a00c0SKevin Lo.Ar member
37799a00c0SKevin Lofrom the start of the structure
38799a00c0SKevin Lo.Ar type .
39799a00c0SKevin Lo.Pp
40799a00c0SKevin LoA compiler error will result if
41799a00c0SKevin Lo.Ar member
42799a00c0SKevin Lois not aligned to a byte boundary (i.e. it is a bit-field).
43799a00c0SKevin Lo.Sh STANDARDS
44799a00c0SKevin LoThe
45799a00c0SKevin Lo.Fn offsetof
46799a00c0SKevin Lomacro conforms to
47799a00c0SKevin Lo.St -ansiC .
48