diff options
author | Jason McIntyre <jmc@cvs.openbsd.org> | 2010-02-18 18:28:19 +0000 |
---|---|---|
committer | Jason McIntyre <jmc@cvs.openbsd.org> | 2010-02-18 18:28:19 +0000 |
commit | 8a5c72dd500a15abc4664a2ccefa9db2ac97d67c (patch) | |
tree | 7a334ae36761901651d4039c070ff595d40c2746 | |
parent | c25431f2413040f24b6e1a45acc202a70d1a7771 (diff) |
document offsetof; from Thomas Pfaff
ok kettenis millert otto
-rw-r--r-- | share/man/man3/Makefile | 4 | ||||
-rw-r--r-- | share/man/man3/offsetof.3 | 44 |
2 files changed, 46 insertions, 2 deletions
diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index d4bfafcc210..f4fef38f6b0 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.20 2008/05/11 22:19:09 millert Exp $ +# $OpenBSD: Makefile,v 1.21 2010/02/18 18:28:18 jmc Exp $ # @(#)Makefile 8.2 (Berkeley) 12/13/93 MAN= assert.3 bitstring.3 CMSG_DATA.3 dlfcn.3 dl_iterate_phdr.3 end.3 \ - intro.3 queue.3 stdarg.3 sysexits.3 tree.3 + intro.3 offsetof.3 queue.3 stdarg.3 sysexits.3 tree.3 MLINKS+=bitstring.3 bit_alloc.3 bitstring.3 bit_clear.3 \ bitstring.3 bit_decl.3 bitstring.3 bit_ffc.3 bitstring.3 bit_ffs.3 \ bitstring.3 bit_nclear.3 bitstring.3 bit_set.3 \ diff --git a/share/man/man3/offsetof.3 b/share/man/man3/offsetof.3 new file mode 100644 index 00000000000..08cf5cc4ef3 --- /dev/null +++ b/share/man/man3/offsetof.3 @@ -0,0 +1,44 @@ +.\" $OpenBSD: offsetof.3,v 1.1 2010/02/18 18:28:18 jmc Exp $ +.\" +.\" Copyright (c) 2010 Thomas Pfaff <tpfaff@tp76.info> +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" +.Dd $Mdocdate: February 18 2010 $ +.Dt OFFSETOF 3 +.Os +.Sh NAME +.Nm offsetof +.Nd offset of a structure member +.Sh SYNOPSIS +.Fd #include <stddef.h> +.Ft size_t +.Fn offsetof "type" "member" +.Sh DESCRIPTION +The +.Fn offsetof +macro expands to an integer constant expression and yields the offset, +in bytes, of the field +.Ar member +from the start of the structure +.Ar type . +.Pp +A compiler error will result if +.Ar member +is not aligned to a byte boundary (i.e. it is a bit-field). +.Sh STANDARDS +The +.Fn offsetof +macro conforms to +.St -ansiC . |