<div dir="ltr"><div><div><div><br><br>On Wed, Dec 21, 2016 at 7:53 AM, Moritz Lennert <<a href="mailto:mlennert@club.worldonline.be">mlennert@club.worldonline.be</a>> wrote:<br>><br>><br>><br>> Le 20 décembre 2016 23:39:09 GMT+01:00, Markus Metz <<a href="mailto:markus.metz.giswork@gmail.com">markus.metz.giswork@gmail.com</a>> a écrit :<br>> >On Tue, Dec 20, 2016 at 11:09 PM, Martin Landa <<a href="mailto:landa.martin@gmail.com">landa.martin@gmail.com</a>><br>> >wrote:<br>> >><br>> >> Hi,<br>> >><br>> >> 2016-12-20 22:17 GMT+01:00 Markus Metz<br>> ><<a href="mailto:markus.metz.giswork@gmail.com">markus.metz.giswork@gmail.com</a>>:<br>> >> > I think the module is automatically compiled only if it is added to<br>> >> > grass-addons/grass7/imagery/Makefile which it is not yet.<br>> >><br>> >> no it's compiled automatically, see [1].<br>> ><br>> >OK. Then what is the reason for the existence of<br>> >grass-addons/grass7/imagery/Makefile?<br>> ><br>> >> There is an compilation error. Ma<br>> >><br>> >> [1]<br>> ><a href="https://wingrass.fsv.cvut.cz/grass73/x86_64/addons/grass-7.3.svn/logs/i.superpixels.slic.log">https://wingrass.fsv.cvut.cz/grass73/x86_64/addons/grass-7.3.svn/logs/i.superpixels.slic.log</a><br>> ><br>> >fmin needs to be replaced with a macro MIN as used by many other<br>> >modules,<br>> >maybe with a test for nan.<br>><br>> Simply using fmin (from math.h IIRC), does the job for me. Any reason not to use it ?<br><br></div>Because it requires -std=c99 or higher whereas most of GRASS C code tries to comply with c89, because custom MIN and MAX macros are used frequently within the GRASS code base, because the usage of fmin as e.g. "fmin(double (g_width-1), seedx);" is wrong. The main argument is to avoid C standard 99 because not all compilers have the same idea of C standards other than c89: incomplete and different support for c99 (or higher) features in different compilers and different versions of the same compiler.<br><br>Adding<br><br>#undef MIN<br>#define MIN(a,b) ((a) < (b) ? (a) : (b))<br><br></div>as in other GRASS modules is a nice solution to keep things simple and portable.<br><br></div>Markus M<br><div><div><div><br></div></div></div></div>