diff options
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/internals.texi | 31 |
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 @@ | |||
| 1 | 2014-05-08 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * internals.texi (C Dialect): New section. | ||
| 4 | (C Integer Types): Mention bool_bf. | ||
| 5 | |||
| 1 | 2014-04-30 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2014-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 | |||
| 105 | under the terms of the GNU Free Documentation License, Version 1.3 or | 105 | under the terms of the GNU Free Documentation License, Version 1.3 or |
| 106 | any later version published by the Free Software Foundation; with the | 106 | any later version published by the Free Software Foundation; with the |
| 107 | Invariant Sections being ``GNU General Public License,'' with the | 107 | Invariant Sections being ``GNU General Public License,'' with the |
| 108 | Front-Cover texts being ``A GNU Manual,'' and with the Back-Cover | 108 | Front-Cover Texts being ``A GNU Manual,'' and with the Back-Cover |
| 109 | Texts as in (a) below. A copy of the license is included in the | 109 | Texts as in (a) below. A copy of the license is included in the |
| 110 | section entitled ``GNU Free Documentation License.'' | 110 | section 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 | |||
| 575 | Emacs session. | 576 | Emacs session. |
| 576 | @end defvar | 577 | @end defvar |
| 577 | 578 | ||
| 579 | @node C Dialect | ||
| 580 | @section C Dialect | ||
| 581 | @cindex C programming language | ||
| 582 | |||
| 583 | The 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, | ||
| 585 | typically at configuration time, and the Emacs build procedure | ||
| 586 | provides a substitute implementation if necessary. Some C99 features, | ||
| 587 | such as declarations after statements, are too difficult to provide | ||
| 588 | substitutes for, so they are avoided entirely. | ||
| 589 | |||
| 590 | At some point in the not-too-distant future the base C dialect will | ||
| 591 | change 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 | |||
| 1616 | signed integer value. | 1631 | signed integer value. |
| 1617 | 1632 | ||
| 1618 | @item | 1633 | @item |
| 1619 | In bitfields, prefer @code{unsigned int} or @code{signed int} to | ||
| 1620 | @code{int}, as @code{int} is less portable: it might be signed, and | ||
| 1621 | might not be. Single-bit bit fields are invariably @code{unsigned | ||
| 1622 | int} so that their values are 0 and 1. | ||
| 1623 | |||
| 1624 | @item | ||
| 1625 | Prefer @code{bool}, @code{false} and @code{true} for booleans. | 1634 | Prefer @code{bool}, @code{false} and @code{true} for booleans. |
| 1626 | Using @code{bool} can make programs easier to read and a bit faster than | 1635 | Using @code{bool} can make programs easier to read and a bit faster than |
| 1627 | using @code{int}. Although it is also OK to use @code{int}, @code{0} | 1636 | using @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 | |||
| 1629 | using @code{bool}, respect the limitations of the replacement | 1638 | using @code{bool}, respect the limitations of the replacement |
| 1630 | implementation of @code{bool}, as documented in the source file | 1639 | implementation 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 |
| 1632 | platforms. | 1641 | platforms. In particular, boolean bitfields should be of type |
| 1642 | @code{bool_bf}, not @code{bool}, so that they work correctly even when | ||
| 1643 | compiling Objective C with standard GCC. | ||
| 1644 | |||
| 1645 | @item | ||
| 1646 | In bitfields, prefer @code{unsigned int} or @code{signed int} to | ||
| 1647 | @code{int}, as @code{int} is less portable: it might be signed, and | ||
| 1648 | might 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? |