Re: [PATCH 3/3] Initialize variables with values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 09, 2013 at 03:13:39AM +0200, Sven Strickroth wrote:
> With MSVC initializing a variable with "int a=a" causes a warning about
> using an uninitialized value.
> 
> Signed-off-by: Sven Strickroth <email@xxxxxxxxxx>
> ---
>  builtin/rev-list.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/builtin/rev-list.c b/builtin/rev-list.c
> index 67701be..13afacd 100644
> --- a/builtin/rev-list.c
> +++ b/builtin/rev-list.c
> @@ -338,7 +338,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);

But this generates worse code, at least using gcc 4.7.2:

--- old	2013-05-09 14:33:22.000000000 +0200
+++ new	2013-05-09 14:33:02.000000000 +0200
@@ -1,2 +1,2 @@
    text	   data	    bss	    dec	    hex	filename
-   4283	      0	      0	   4283	   10bb	builtin/rev-list.o
+   4299	      0	      0	   4299	   10cb	builtin/rev-list.o

Krzysiek
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]