From 82976003e8b6662e88ecc97fc385f0cd81553148 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Fri, 6 Jun 2025 16:38:04 +0800 Subject: [PATCH 1/3] Remove empty lines at start and end of code block --- docs/code-quality/c6393.md | 1 - docs/cpp/functions-cpp.md | 1 - docs/porting/visual-cpp-what-s-new-2003-through-2015.md | 1 - 3 files changed, 3 deletions(-) diff --git a/docs/code-quality/c6393.md b/docs/code-quality/c6393.md index 07f0c540f0..9ee04372b6 100644 --- a/docs/code-quality/c6393.md +++ b/docs/code-quality/c6393.md @@ -26,7 +26,6 @@ Code analysis name: `LEAP_YEAR_INVALID_DATE_KEYED_LOOKUP` The following code creates a lookup table for the day of the year, assuming 365 days per year. However, this doesn't work if the year is a leap year: ```cpp - #include void foo(int year) diff --git a/docs/cpp/functions-cpp.md b/docs/cpp/functions-cpp.md index 92c4ee5158..4c30f1844e 100644 --- a/docs/cpp/functions-cpp.md +++ b/docs/cpp/functions-cpp.md @@ -77,7 +77,6 @@ Optional parts of a function declaration are: ```cpp //Declare printf with C linkage. extern "C" int printf( const char *fmt, ... ); - ``` For more information, see [Translation units and linkage](../cpp/program-and-linkage-cpp.md). diff --git a/docs/porting/visual-cpp-what-s-new-2003-through-2015.md b/docs/porting/visual-cpp-what-s-new-2003-through-2015.md index 827474f7a8..e2a8e80cb9 100644 --- a/docs/porting/visual-cpp-what-s-new-2003-through-2015.md +++ b/docs/porting/visual-cpp-what-s-new-2003-through-2015.md @@ -226,7 +226,6 @@ Although these differences can affect your source code or other build artifacts, ```cpp error C3688: invalid literal suffix '_x'; literal operator or literal operator template 'operator ""_x' not found note: Did you forget a space between the string literal and the prefix of the following string literal? - ``` To fix this problem, add a space between the string literal and the macro. From f165e31b9b28db92fd317f5d94a4912e3e470790 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Fri, 6 Jun 2025 16:38:53 +0800 Subject: [PATCH 2/3] Update metadata for 2 topics --- docs/code-quality/c6393.md | 2 +- docs/cpp/functions-cpp.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/code-quality/c6393.md b/docs/code-quality/c6393.md index 9ee04372b6..c35c7134b5 100644 --- a/docs/code-quality/c6393.md +++ b/docs/code-quality/c6393.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Warning C6393" title: Warning C6393 +description: "Learn more about: Warning C6393" ms.date: 11/29/2023 f1_keywords: ["C6393", "LEAP_YEAR_INVALID_DATE_KEYED_LOOKUP", "__WARNING_LEAP_YEAR_INVALID_DATE_KEYED_LOOKUP"] helpviewer_keywords: ["C6393"] diff --git a/docs/cpp/functions-cpp.md b/docs/cpp/functions-cpp.md index 4c30f1844e..58670206a1 100644 --- a/docs/cpp/functions-cpp.md +++ b/docs/cpp/functions-cpp.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Functions (C++)" title: "Functions (C++)" -ms.date: "11/19/2018" +description: "Learn more about: Functions (C++)" +ms.date: 11/19/2018 helpviewer_keywords: ["defaults, arguments", "function definitions", "function definitions, about function definitions", "default arguments", "declarators, functions"] --- # Functions (C++) From d954c467281597ea0cc7762986c91d8c8b1d9805 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Fri, 6 Jun 2025 16:41:06 +0800 Subject: [PATCH 3/3] Adjust spacing in C6393 warning examples --- docs/code-quality/c6393.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/code-quality/c6393.md b/docs/code-quality/c6393.md index c35c7134b5..a905c012a2 100644 --- a/docs/code-quality/c6393.md +++ b/docs/code-quality/c6393.md @@ -26,25 +26,25 @@ Code analysis name: `LEAP_YEAR_INVALID_DATE_KEYED_LOOKUP` The following code creates a lookup table for the day of the year, assuming 365 days per year. However, this doesn't work if the year is a leap year: ```cpp -#include - -void foo(int year) -{ - const std::vector items(365); // C6393 - // Initialize items and use it... +#include + +void foo(int year) +{ + const std::vector items(365); // C6393 + // Initialize items and use it... } ``` To fix the problem, adjust the size of the lookup table as the table is created according to the result of appropriate leap year check: ```cpp -#include - -void foo(int year) -{ - bool isLeapYear = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); - const std::vector items(isLeapYear ? 366 : 365); - // Initialize items and use it... +#include + +void foo(int year) +{ + bool isLeapYear = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); + const std::vector items(isLeapYear ? 366 : 365); + // Initialize items and use it... } ```