Reword note about fgets() in 1994/ldb/README.md
The fact fgets() makes it print another line is less of a problem in macOS as it already printed two lines - one as a warning about gets() and then the output of the program. Keeping gets() is a problem but not keeping it can also be considered a problem. Given it prevents a warning it's a good thing as it can be potentially alarming.
This commit is contained in:
1 parent
79602d9ce7
commit
c0fa14424b
1 file changed
+8
-6
+8
-6
@@ -16,12 +16,14 @@ make all
|
|||||||
compile and work with modern compilers. The problem was that `srand()` returns
|
compile and work with modern compilers. The problem was that `srand()` returns
|
||||||
void but it was used in a `||` expression. Thus the comma operator was needed.
|
void but it was used in a `||` expression. Thus the comma operator was needed.
|
||||||
Cody also changed the entry to use `fgets()` instead of `gets()` to make it
|
Cody also changed the entry to use `fgets()` instead of `gets()` to make it
|
||||||
safe for lines greater than 231 in length. Note that this now prints a newline
|
safe for lines greater than 231 in length and to prevent a warning at linking or
|
||||||
after the output but this seems like a worthy compromise for making it safer
|
at runtime. Note that this now prints a newline after the output but this seems
|
||||||
(fixing it is more problematic than it is worth). A subtlety about this fix: if
|
like a worthy compromise for making it safer (fixing it is more problematic than
|
||||||
a line is greater than 231 in length if the program chooses that line it might
|
it is worth). In macOS another line of output would be shown anyway namely the
|
||||||
print the first 231 characters or it might print (up to) the next 231 characters
|
warning that it uses gets(). A subtlety about this fix: if a line is greater
|
||||||
and so on. Thank you Cody for your assistance!
|
than 231 in length if the program chooses that line it might print the first 231
|
||||||
|
characters or it might print (up to) the next 231 characters and so on. Thank
|
||||||
|
you Cody for your assistance!
|
||||||
|
|
||||||
For the original fixed version [ldb.alt.c](ldb.alt.c) see below.
|
For the original fixed version [ldb.alt.c](ldb.alt.c) see below.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user