Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Two answers.

Some embedded envs I've worked in there isn't a argc/argv/envp.

In the Unix envs I've worked in it also takes envp. I think I've use that 3 times in the roughly 25 years I mostly wrote c.



> Some embedded envs I've worked in there isn't a argc/argv/envp.

I would think you are generally using _start rather than main in embedded systems. But in embedded systems portability is generally out the window so it makes sense that some _start's call main without arguments.

> In the Unix envs I've worked in it also takes envp. I think I've use that 3 times in the roughly 25 years I mostly wrote c.

I have never tried to use envp and had it fail, but for maximally portable code you should use getenv() or if on posix you can use the environ variable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: