]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - share/man/man3/offsetof.3
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / share / man / man3 / offsetof.3
1 .\"     $OpenBSD: offsetof.3,v 1.2 2010/02/18 18:30:19 jmc Exp $
2 .\"
3 .\" Copyright (c) 2010 Thomas Pfaff <tpfaff@tp76.info>
4 .\"
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
8 .\"
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 .\"
17 .\" $FreeBSD$
18 .\"
19 .Dd February 18 2010
20 .Dt OFFSETOF 3
21 .Os
22 .Sh NAME
23 .Nm offsetof
24 .Nd offset of a structure member
25 .Sh SYNOPSIS
26 .In stddef.h
27 .Ft size_t
28 .Fn offsetof "type" "member"
29 .Sh DESCRIPTION
30 The
31 .Fn offsetof
32 macro expands to an integer constant expression of type
33 .Ft size_t
34 and yields the offset,
35 in bytes, of the field
36 .Ar member
37 from the start of the structure
38 .Ar type .
39 .Pp
40 A compiler error will result if
41 .Ar member
42 is not aligned to a byte boundary (i.e. it is a bit-field).
43 .Sh STANDARDS
44 The
45 .Fn offsetof
46 macro conforms to
47 .St -ansiC .