Unused variable in gomoku

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unused variable in gomoku

Peter Williams-8
Hi Everyone,

I recently noticed that there is an unused variable in gomoku.h. I
have included a diff that removes the unused variable, and have
verified that gomoku compiles cleanly afterwards. I have performed a
search for this header file within the source tree, and it looks like
gomoku is the only program that references this header file.

I thought I should share this in case it should be removed to cleanup the code!

Thanks and have a nice day,
Peter


Index: gomoku.h
===================================================================
RCS file: /cvs/src/games/gomoku/gomoku.h,v
retrieving revision 1.12
diff -u -p -u -p -r1.12 gomoku.h
--- gomoku.h    4 Jan 2016 17:33:24 -0000       1.12
+++ gomoku.h    26 Dec 2017 22:05:11 -0000
@@ -222,7 +222,6 @@ struct      spotstr {
        u_char          s_nforce[2];    /* number of <1,x> combos */
        struct elist    *s_empty;       /* level n combo completion spots */
        struct elist    *s_nempty;      /* level n+1 combo completion spots */
-       int             dummy[2];       /* XXX */
 };

 /* flag values for s_flg */

Reply | Threaded
Open this post in threaded view
|

Re: Unused variable in gomoku

Peter Williams-8
Hi Everyone,

After researching this some more I realized that I think this integer
array may be in this structure for padding/data alignment. When I
compile this on a 64-bit computer with -Wpadded I do not receive any
errors regarding this structure, but I think this must have been an
issue with other architectures since it was put there in the first
place! I apologize for not realizing this before posting. I was
wondering--is this something the compiler/processor should adjust for
on modern systems?

Sorry for any inconvenience and thanks for your time,
Peter

On Tue, Dec 26, 2017 at 2:28 PM, Peter Williams <[hidden email]> wrote:

> Hi Everyone,
>
> I recently noticed that there is an unused variable in gomoku.h. I
> have included a diff that removes the unused variable, and have
> verified that gomoku compiles cleanly afterwards. I have performed a
> search for this header file within the source tree, and it looks like
> gomoku is the only program that references this header file.
>
> I thought I should share this in case it should be removed to cleanup the code!
>
> Thanks and have a nice day,
> Peter
>
>
> Index: gomoku.h
> ===================================================================
> RCS file: /cvs/src/games/gomoku/gomoku.h,v
> retrieving revision 1.12
> diff -u -p -u -p -r1.12 gomoku.h
> --- gomoku.h    4 Jan 2016 17:33:24 -0000       1.12
> +++ gomoku.h    26 Dec 2017 22:05:11 -0000
> @@ -222,7 +222,6 @@ struct      spotstr {
>         u_char          s_nforce[2];    /* number of <1,x> combos */
>         struct elist    *s_empty;       /* level n combo completion spots */
>         struct elist    *s_nempty;      /* level n+1 combo completion spots */
> -       int             dummy[2];       /* XXX */
>  };
>
>  /* flag values for s_flg */