[Proj] Code style in Proj

Thomas Knudsen knudsen.thomas at gmail.com
Tue Apr 24 04:45:33 EST 2018


> In C too, but since C99.

AFAIK this only applies to the "for (int i = 0;  i < n; i++)" syntax.

while (...) {
    int i = 123, j = 345;
    k = i + j;
}

has been correct (and imho, preferable) syntax since K&R C

/Thomas


2018-04-23 0:17 GMT+02:00 Mateusz Loskot <mateusz at loskot.net>:

> On 22 April 2018 at 20:07, Kurt Schwehr <schwehr at gmail.com> wrote:
> > Kristian,
> >
> > Things to do when you are about to have a kid and want a distraction :)
>
> Congratulations! I still remember that distraction pursuit myself ;-)
>
> > On Sun, Apr 22, 2018 at 8:10 AM, Kristian Evers <kreve at sdfe.dk> wrote:
> >>
> >> - Combine definition and declaration
> >>
> >> It works in this example but I don’t think it can be enforced in more
> >> complicated code.
> >> Variable declarations have to be made at the start of a block and that
> is
> >> not always possible.
> >>
> >
> > Agreed.  Not always possible or always a good thing.  And a style
> question
> > is do you allow variables to be defined in sub scopes?  In C++, the
> answer
> > is usually to keep things as tight/narrow as possible.
>
> In C too, but since C99.
>
> Best regards,
> --
> Mateusz Loskot, http://mateusz.loskot.net
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20180424/f3d1de75/attachment.htm 


More information about the Proj mailing list