On 28 December 2014 at 13:36, Peter Kelly <[email protected]> wrote:

> Actually it does, but I just saw the for (i; …) which Xcode was giving an
> “Expression result unused” warning. A better fix would be just to remove
> that all together, so we have for (; allGroups[i] && strcmp(argv[2],
> allGroups[i]->name); i++) ; - there’s no need to mention the i variable in
> the initialisation phase. I’ll commit this in shortly.
>

Interesting, with VC (windows) the "if" after the loop never sees the "i"
from the loop, its always 0. Seems Xcode has a more relaxed view on scoping
rules, good to know.

But I agree your new commit is perfect.

rgds
jan i.


>
> --
> Dr. Peter M. Kelly
> [email protected]
> http://www.kellypmk.net/
>
> PGP key: http://www.kellypmk.net/pgp-key <http://www.kellypmk.net/pgp-key>
> (fingerprint 5435 6718 59F0 DD1F BFA0 5E46 2523 BAA1 44AE 2966)
>
> > On 28 Dec 2014, at 7:31 pm, jan i <[email protected]> wrote:
> >
> > I believe this will never work.
> >
> > "i" is declared a procedure level, and you redeclare it in the "for"
> which
> > will shadow over the procedure global "i", but after the "for" there is
> an
> > "if" that looks at "i".
> >
> > Not sure what the "int i" in the "for loop" is good for ?
> >
> > rgds
> > jan i.
> >
> >
> > On 28 December 2014 at 13:12, <[email protected]> wrote:
> >
> >> Repository: incubator-corinthia
> >> Updated Branches:
> >>  refs/heads/master 145000d46 -> ddffbd446
> >>
> >>
> >> Fix compile warning about missing type/init value
> >>
> >>
> >> Project:
> http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
> >> Commit:
> >>
> http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/ddffbd44
> >> Tree:
> >>
> http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/ddffbd44
> >> Diff:
> >>
> http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/ddffbd44
> >>
> >> Branch: refs/heads/master
> >> Commit: ddffbd44655945ba1045cc7bbb8f384fa6695f63
> >> Parents: 145000d
> >> Author: Peter Kelly <[email protected]>
> >> Authored: Sun Dec 28 19:12:24 2014 +0700
> >> Committer: Peter Kelly <[email protected]>
> >> Committed: Sun Dec 28 19:12:24 2014 +0700
> >>
> >> ----------------------------------------------------------------------
> >> consumers/dftest/src/main.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >> ----------------------------------------------------------------------
> >>
> >>
> >>
> >>
> http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/ddffbd44/consumers/dftest/src/main.c
> >> ----------------------------------------------------------------------
> >> diff --git a/consumers/dftest/src/main.c b/consumers/dftest/src/main.c
> >> index c7e5418..4a030d0 100644
> >> --- a/consumers/dftest/src/main.c
> >> +++ b/consumers/dftest/src/main.c
> >> @@ -353,7 +353,7 @@ int main(int argc, const char **argv)
> >>         TestGroup *singleGroup[] = { NULL, NULL };
> >>         int        i = 0;
> >>
> >> -        for (i; allGroups[i] && strcmp(argv[2], allGroups[i]->name);
> i++)
> >> ;
> >> +        for (int i = 0; allGroups[i] && strcmp(argv[2],
> >> allGroups[i]->name); i++) ;
> >>         if (allGroups[i]) {
> >>           singleGroup[0] = allGroups[i];
> >>           utrun(singleGroup, 1, 0, NULL);
> >>
> >>
>
>

Reply via email to