On Mon, 2020-01-06 at 05:33 -0500, Dennis Clarke wrote:
> The only nit, and it is a little nit, is the strange use of a three
> parameter main() in src/main.c line 1054 and this is a "warning". Well
> strictly speaking, pun intended, that isn't a terrible sin but it isn't
> correct either. Sure, tossing in char **envp as the third rail on the
> main() can work and usually does work it isn't supposed to work.
> 
> I looked in there and there is no good reason to not use getenv() but
> who knows what voodoo to do in windows32?  I surely don't.

Just for clarity, getenv() isn't sufficient.  That requires that you know
what variables you want to look up: in GNU make we need to walk through all
the variables so we can import each one as a make variable.

In POSIX we can use extern char** environ instead.  On Windows you can use
_environ although my impression is that might not work everywhere (but it
might be good enough for make).  On other systems there may be other
things.

While the third arg to main isn't actually part of any standard, even
POSIX, it's actually very widely supported.


Reply via email to