aboutsummaryrefslogtreecommitdiffstats
path: root/man2/timerfd_create.2
diff options
context:
space:
mode:
authorAlex Colomar <alx.manpages@gmail.com>2022-09-15 16:40:27 +0200
committerAlex Colomar <alx.manpages@gmail.com>2022-09-15 18:07:48 +0200
commitb42296e4feaffd0ca4e5675fa181d19891f947ce (patch)
treeb16ebd13da8366c95ace85f538f32f3043dc12e3 /man2/timerfd_create.2
parent489712257bb14b3674f9e9037c65b371b3f570c0 (diff)
downloadman-pages-b42296e4feaffd0ca4e5675fa181d19891f947ce.tar.gz
Various pages: EXAMPLES: Use unsigned types for loop iterators
Looping with unsigned types is safer. See the link below. When the iterators are used for accessing an array, use size_t; otherwise, use the most appropriate unsigned type, which in most cases is just 'unsigned int'. Also adjust other variables that have to interact with the iterators, to avoid comparison of integers of different signedness. Link: <https://gustedt.wordpress.com/2013/07/15/a-praise-of-size_t-and-other-unsigned-types/> Cc: Jens Gustedt <jens.gustedt@inria.fr> Signed-off-by: Alex Colomar <alx.manpages@gmail.com>
Diffstat (limited to 'man2/timerfd_create.2')
-rw-r--r--man2/timerfd_create.24
1 files changed, 2 insertions, 2 deletions
diff --git a/man2/timerfd_create.2 b/man2/timerfd_create.2
index 9850f14c9e..c53c97e248 100644
--- a/man2/timerfd_create.2
+++ b/man2/timerfd_create.2
@@ -633,9 +633,9 @@ int
main(int argc, char *argv[])
{
struct itimerspec new_value;
- int max_exp, fd;
+ int fd;
struct timespec now;
- uint64_t exp, tot_exp;
+ uint64_t exp, tot_exp, max_exp;
ssize_t s;
if (argc != 2 && argc != 4) {