lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Jul 23, 2015 at 06:41:25PM +0200, Szymon Kuczur Whallalabs wrote:
> Thank you very much for your response. Sorry for inconvenience with the patch.
> 
> I was trying to create a cocoa pod, and those warnings, which you deducted perfectly, made lua not usable in such a way. 
> 
> LUA_USE_POSIX - that is great, you miss things like that when you are in a hurry :(.
> 
> >> "What is wrong with 'system()'?”
> 
> While compiling against iOS8 'system()’ call is marked as deprecated - proposed solution is to use posix API-s. So maybe at least I found one useful thing :)

The semantics are entirely different. system invokes the shell, posix_spawn
doesn't. If you changed this to posix_spawn, then something like

	os.execute("echo 'foo' > /tmp/outputfile")

wouldn't work at all.

Note that system is defined by ISO C. If system isn't available than iOS
cannot claim to provide a standards-compliant hosted C platform. I doubt iOS
will actually remove this routine, anymore than it would remove the
definitions of stdin, stdout, stderr, which I assume are equally useless
from an iOS application. The standard permits system to always fail in
environments where no command interpreter is available, so they could simply
change the implementation to

	int system(const char *cmd) {
		return 0;
	}

rather than remove it entirely.

> >> -  lua_Integer ni;
> 
> This one, I’ll see if I can tune the compiler to be smarter then.

You'd probably have to hack on clang internals. These spurious warnings come
and go in clang and GCC as bugs are fixed and new ones introduced.