<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Kurt,
<div class=""><br class="">
</div>
<div class="">I think it looks good. I tried compiling the code and again I had the problem with declarations like</div>
<div class=""><br class="">
</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>XY xy = {0.0, 0.0};</div>
<div class=""><br class="">
</div>
<div class="">I’ve fixed those in a fork of your gist. See revision 2 in [0] for a proposed solution that I think</div>
<div class="">is in line with your ideas</div>
<div class=""><br class="">
</div>
<div class="">I like how you’ve separated includes from the standard library on the PROJ internal includes. On</div>
<div class="">a related note (for those who don’t already know) I have recently introduced the proj_math.h</div>
<div class="">header which is intended as a PROJ replacement of math.h. proj_math.h’s purpose in life is to</div>
<div class="">make sure that we can use C99 math functions on systems where they are not available.</div>
<div class="">proj_math.h includes math.h and defines functions such as isnan() and hypot(). This way they</div>
<div class="">can be used as you would on a C99-compatible system as long as proj_math.h is included.</div>
<div class="">See revision 3 in [0].</div>
<div class=""><br class="">
</div>
<div class="">Would you be willing to write up a simple style guide for PROJ based on the ideas you have presented in</div>
<div class="">this thread?</div>
<div class="">
<div><br class="">
</div>
<div>/Kristian</div>
<div><br class="">
</div>
<div>[0] <a href="https://gist.github.com/kbevers/17ec703942646e401b28a0975b28771d/revisions" class="">https://gist.github.com/kbevers/17ec703942646e401b28a0975b28771d/revisions</a></div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 24 Apr 2018, at 12:05, Mateusz Loskot <<a href="mailto:mateusz@loskot.net" class="">mateusz@loskot.net</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">On 24 April 2018 at 11:45, Thomas Knudsen <<a href="mailto:knudsen.thomas@gmail.com" class="">knudsen.thomas@gmail.com</a>> wrote:<br class="">
<blockquote type="cite" class="">
<blockquote type="cite" class="">In C too, but since C99.<br class="">
</blockquote>
<br class="">
AFAIK this only applies to the "for (int i = 0; i < n; i++)" syntax.<br class="">
<br class="">
while (...) {<br class="">
int i = 123, j = 345;<br class="">
k = i + j;<br class="">
}<br class="">
<br class="">
has been correct (and imho, preferable) syntax since K&R C<br class="">
</blockquote>
<br class="">
AFAIK, it's about compound statement.<br class="">
C89 requires declaration at the top of blocks, while C99 lifts that:<br class="">
<br class="">
$ cat test.c<br class="">
int main()<br class="">
{<br class="">
int i = 0;<br class="">
while (i < 10)<br class="">
{<br class="">
int j = 345;<br class="">
i = i + j;<br class="">
}<br class="">
<br class="">
{<br class="">
int z = 0;<br class="">
z = 1;<br class="">
}<br class="">
int x = 1;<br class="">
}<br class="">
<br class="">
$ gcc -std=c89 -pedantic test.c<br class="">
test.c: In function ‘main’:<br class="">
test.c:14:5: warning: ISO C90 forbids mixed declarations and code<br class="">
[-Wdeclaration-after-statement]<br class="">
int x = 1;<br class="">
^~~<br class="">
<br class="">
$ gcc -std=c99 -pedantic test.c<br class="">
$<br class="">
<br class="">
<br class="">
Best regards,<br class="">
-- <br class="">
Mateusz Loskot, <a href="http://mateusz.loskot.net" class="">http://mateusz.loskot.net</a><br class="">
_______________________________________________<br class="">
Proj mailing list<br class="">
<a href="mailto:Proj@lists.maptools.org" class="">Proj@lists.maptools.org</a><br class="">
http://lists.maptools.org/mailman/listinfo/proj</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>