From 1dd2c9d0ca11a2601b3f659499691166983a25ab Mon Sep 17 00:00:00 2001 From: Yuning Zhang Date: Thu, 23 Nov 2023 18:10:12 -0800 Subject: [PATCH 1/2] nits Signed-off-by: Yuning Zhang --- docs/cpp/inline-functions-cpp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cpp/inline-functions-cpp.md b/docs/cpp/inline-functions-cpp.md index 00712e25a4b..2b44a860322 100644 --- a/docs/cpp/inline-functions-cpp.md +++ b/docs/cpp/inline-functions-cpp.md @@ -233,7 +233,7 @@ int main() { The intent of the expression `toupper(getc(stdin))` is that a character should be read from the console device (`stdin`) and, if necessary, converted to uppercase. -Because of the implementation of the macro, `getc` is executed once to determine whether the character is greater than or equal to "a," and once to determine whether it's less than or equal to "z." If it is in that range, `getc` is executed again to convert the character to uppercase. It means the program waits for two or three characters when, ideally, it should wait for only one. +Because of the implementation of the macro, `getc` is executed once to determine whether the character is greater than or equal to "a", and once to determine whether it's less than or equal to "z". If it is in that range, `getc` is executed again to convert the character to uppercase. It means the program waits for two or three characters when, ideally, it should wait for only one. Inline functions remedy the problem previously described: From 8f1c44171f090b80f0530ffee23186b6aaacf9ae Mon Sep 17 00:00:00 2001 From: Tyler Whitney Date: Tue, 28 Nov 2023 16:17:40 -0800 Subject: [PATCH 2/2] Update inline-functions-cpp.md Went for a super literal reading of what we are comparing against. --- docs/cpp/inline-functions-cpp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cpp/inline-functions-cpp.md b/docs/cpp/inline-functions-cpp.md index 2b44a860322..ca43ba5a87f 100644 --- a/docs/cpp/inline-functions-cpp.md +++ b/docs/cpp/inline-functions-cpp.md @@ -233,7 +233,7 @@ int main() { The intent of the expression `toupper(getc(stdin))` is that a character should be read from the console device (`stdin`) and, if necessary, converted to uppercase. -Because of the implementation of the macro, `getc` is executed once to determine whether the character is greater than or equal to "a", and once to determine whether it's less than or equal to "z". If it is in that range, `getc` is executed again to convert the character to uppercase. It means the program waits for two or three characters when, ideally, it should wait for only one. +Because of the implementation of the macro, `getc` is executed once to determine whether the character is greater than or equal to `'a'`, and once to determine whether it's less than or equal to `'z'`. If it is in that range, `getc` is executed again to convert the character to uppercase. It means the program waits for two or three characters when, ideally, it should wait for only one Inline functions remedy the problem previously described: