aboutsummaryrefslogtreecommitdiffstats
path: root/man7/unix.7
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 /man7/unix.7
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 'man7/unix.7')
-rw-r--r--man7/unix.72
1 files changed, 1 insertions, 1 deletions
diff --git a/man7/unix.7 b/man7/unix.7
index 37f22320f6..f44ffbe309 100644
--- a/man7/unix.7
+++ b/man7/unix.7
@@ -1154,7 +1154,7 @@ main(int argc, char *argv[])
/* Send arguments. */
- for (int i = 1; i < argc; ++i) {
+ for (size_t i = 1; i < argc; ++i) {
ret = write(data_socket, argv[i], strlen(argv[i]) + 1);
if (ret == \-1) {
perror("write");