aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/elisp.texi2
-rw-r--r--doc/lispref/internals.texi31
3 files changed, 30 insertions, 8 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 0475635e958..2400c6a8e0a 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12014-05-08 Paul Eggert <eggert@cs.ucla.edu>
2
3 * internals.texi (C Dialect): New section.
4 (C Integer Types): Mention bool_bf.
5
12014-04-30 Stefan Monnier <monnier@iro.umontreal.ca> 62014-04-30 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * processes.texi (Filter Functions, Sentinels): Advertise add-function. 8 * processes.texi (Filter Functions, Sentinels): Advertise add-function.
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 567cbe0eea7..22df02113f0 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -105,7 +105,7 @@ Permission is granted to copy, distribute and/or modify this document
105under the terms of the GNU Free Documentation License, Version 1.3 or 105under the terms of the GNU Free Documentation License, Version 1.3 or
106any later version published by the Free Software Foundation; with the 106any later version published by the Free Software Foundation; with the
107Invariant Sections being ``GNU General Public License,'' with the 107Invariant Sections being ``GNU General Public License,'' with the
108Front-Cover texts being ``A GNU Manual,'' and with the Back-Cover 108Front-Cover Texts being ``A GNU Manual,'' and with the Back-Cover
109Texts as in (a) below. A copy of the license is included in the 109Texts as in (a) below. A copy of the license is included in the
110section entitled ``GNU Free Documentation License.'' 110section entitled ``GNU Free Documentation License.''
111 111
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index f85701f5396..bfc9d491c5e 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -15,6 +15,7 @@ internal aspects of GNU Emacs that may be of interest to C programmers.
15* Pure Storage:: Kludge to make preloaded Lisp functions shareable. 15* Pure Storage:: Kludge to make preloaded Lisp functions shareable.
16* Garbage Collection:: Reclaiming space for Lisp objects no longer used. 16* Garbage Collection:: Reclaiming space for Lisp objects no longer used.
17* Memory Usage:: Info about total size of Lisp objects made so far. 17* Memory Usage:: Info about total size of Lisp objects made so far.
18* C Dialect:: What C variant Emacs is written in.
18* Writing Emacs Primitives:: Writing C code for Emacs. 19* Writing Emacs Primitives:: Writing C code for Emacs.
19* Object Internals:: Data formats of buffers, windows, processes. 20* Object Internals:: Data formats of buffers, windows, processes.
20* C Integer Types:: How C integer types are used inside Emacs. 21* C Integer Types:: How C integer types are used inside Emacs.
@@ -575,6 +576,20 @@ The total number of strings that have been allocated so far in this
575Emacs session. 576Emacs session.
576@end defvar 577@end defvar
577 578
579@node C Dialect
580@section C Dialect
581@cindex C programming language
582
583The C part of Emacs is portable to C89: C99-specific features such as
584@samp{<stdbool.h>} and @samp{inline} are not used without a check,
585typically at configuration time, and the Emacs build procedure
586provides a substitute implementation if necessary. Some C99 features,
587such as declarations after statements, are too difficult to provide
588substitutes for, so they are avoided entirely.
589
590At some point in the not-too-distant future the base C dialect will
591change from C89 to C99, and eventually it will no doubt change to C11.
592
578@node Writing Emacs Primitives 593@node Writing Emacs Primitives
579@section Writing Emacs Primitives 594@section Writing Emacs Primitives
580@cindex primitive function internals 595@cindex primitive function internals
@@ -1616,12 +1631,6 @@ Prefer @code{intmax_t} for representing values that might be any
1616signed integer value. 1631signed integer value.
1617 1632
1618@item 1633@item
1619In bitfields, prefer @code{unsigned int} or @code{signed int} to
1620@code{int}, as @code{int} is less portable: it might be signed, and
1621might not be. Single-bit bit fields are invariably @code{unsigned
1622int} so that their values are 0 and 1.
1623
1624@item
1625Prefer @code{bool}, @code{false} and @code{true} for booleans. 1634Prefer @code{bool}, @code{false} and @code{true} for booleans.
1626Using @code{bool} can make programs easier to read and a bit faster than 1635Using @code{bool} can make programs easier to read and a bit faster than
1627using @code{int}. Although it is also OK to use @code{int}, @code{0} 1636using @code{int}. Although it is also OK to use @code{int}, @code{0}
@@ -1629,7 +1638,15 @@ and @code{1}, this older style is gradually being phased out. When
1629using @code{bool}, respect the limitations of the replacement 1638using @code{bool}, respect the limitations of the replacement
1630implementation of @code{bool}, as documented in the source file 1639implementation of @code{bool}, as documented in the source file
1631@file{lib/stdbool.in.h}, so that Emacs remains portable to pre-C99 1640@file{lib/stdbool.in.h}, so that Emacs remains portable to pre-C99
1632platforms. 1641platforms. In particular, boolean bitfields should be of type
1642@code{bool_bf}, not @code{bool}, so that they work correctly even when
1643compiling Objective C with standard GCC.
1644
1645@item
1646In bitfields, prefer @code{unsigned int} or @code{signed int} to
1647@code{int}, as @code{int} is less portable: it might be signed, and
1648might not be. Single-bit bit fields should be @code{unsigned int} or
1649@code{bool_bf} so that their values are 0 or 1.
1633@end itemize 1650@end itemize
1634 1651
1635@c FIXME Mention src/globals.h somewhere in this file? 1652@c FIXME Mention src/globals.h somewhere in this file?