Skip to content

Commit

Permalink
update/expand comments
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87149 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Sep 15, 2024
1 parent 0ab4aa4 commit 2b47439
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions doc/manual/R-exts.texi
Original file line number Diff line number Diff line change
Expand Up @@ -6302,20 +6302,21 @@ include it.
Be careful if using @code{malloc} or @code{calloc}. First, their return
value must always be checked to see if the allocation succeeded -- it is
almost always easier to use @R{}'s @code{R_Calloc}, which does check.
Second, the first argument is of type @code{size_t} and recent compilers
are warning about passing signed arguments (which could get promoted to
ridiculously large values).
Second, the first argument is of type @code{size_t}@footnote{an unsigned
64-bit integer type on recent @R{} platforms.} and some recent compilers
warn about passing @code{int} (signed) arguments (which could get
promoted to ridiculously large values).

@item
For C code, consider using the flag @option{-Wstrict-prototypes} which
is supported by @command{gcc} and @I{LLVM} and Apple @command{clang}. This
has found quite a number of errors where functions have been declared
without arguments and is likely to become the default in future
compilers. (It already is for @I{LLVM} @command{clang} in C23 mode.) Note
that using @code{f()} for a function without any parameters was
deprecated in C99 and C11, but it expected to be non-deprecated in C23.
However, @code{f(void)} is supported by all standards and avoids any
uncertainty.
is supported by @command{gcc} and @I{LLVM} and Apple @command{clang}.
This has found quite a number of errors where functions have been
declared without arguments and is likely to become the default in future
compilers. (It already is for Apple @command{clang} and for @I{LLVM}
@command{clang} in C23 mode.) Note that using @code{f()} for a function
without any parameters was deprecated in C99 and C11, but it expected to
be non-deprecated in C23. However, @code{f(void)} is supported by all
standards and avoids any uncertainty.
@c draft n3054 §6.7.6.3 point 13 and footnote.

@I{LLVM} @command{clang} has a separate warning
Expand Down

0 comments on commit 2b47439

Please sign in to comment.