Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

An environment pointer may also become invalidated by subsequent calls to getenv(). (see See ENV34-C. Do not store pointers returned by certain functions for more information.).

Noncompliant Code Example (POSIX)

...

According to the Visual C++ reference [MSDN],

The environment block passed to main and wmain is a "frozen" copy of the current environment. If you subsequently change the environment via a call to _putenv or _wputenv, the current environment (as returned by getenv / _wgetenv and the _environ / _wenviron variable) will change, but the block pointed to by envp will not change.

...