Re:Three of the Hundred Falsehoods CS Students Believe
by thethirdone on Sunday November 10, 2019 @07:41PM
(#21501259)
> 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.
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.