git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 12/14] rev-list.c: Initialise variables to suppress msvc warnings

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Dec 4, 2010, 19:10 UTC
Message-ID
<4CFA923E.80801@ramsay1.demon.co.uk>

The msvc compiler thinks that two variables could be used while uninitialised and issues the following warnings:

    ...\git\builtin\rev-list.c(400) : warning C4700: uninitialized \
        local variable 'reaches' used
    ...\git\builtin\rev-list.c(400) : warning C4700: uninitialized \
        local variable 'all' used

In order to suppress the warnings, we simply initialise the variables to zero.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 builtin/rev-list.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index ba27d39..e28695f 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -397,7 +397,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
 		mark_edges_uninteresting(revs.commits, &revs, show_edge);
 
 	if (bisect_list) {
-		int reaches = reaches, all = all;
+		int reaches = 0, all = 0;
 
 		revs.commits = find_bisection(revs.commits, &reaches, &all,
 					      bisect_find_all);
-- 
1.7.3
Message 1 of 1 in “rev-list.c: Initialise variables to suppress msvc warnings”
  1. 12/14 rev-list.c: Initialise variables to suppress msvc warningsRamsay Jones, Dec 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.