environment variables - int main(int argc, char *argv[], char *envp[]); vs extern char **environ; #1363
-
Although the envp argument to main is non-standard, is it something OW supports? From my simple testing (really tracking down a weird display issue in a tiny test program that displays the current environment variables [not written by me]) OW will compile and link programs that attempt to use this form of main, but the variable is basically uninitialized and either displays garbage (on DOS) or aborts the program with an error/exception (on Windows). Just curious if I'm overlooking something and OW does actually support it. Not a big deal as it is easily replaced with a reference to the extern environ variable. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
main is defined by C standard and therefore OW support only forms defined by C standard. |
Beta Was this translation helpful? Give feedback.
-
Thank you. |
Beta Was this translation helpful? Give feedback.
main is defined by C standard and therefore OW support only forms defined by C standard.
Anyway call main is defined in OW C run-time startup program that it can be modified if needed.
but envp is not available on all platforms that it will require more work if you need this non-standard main call.
Take into account that envp and environ are two different things, not same.