...
Non-Compliant Code Example
| Wiki Markup |
|---|
In this |
putenv(). The TEST environment variable may take on an unintended value if it is accessed once func() has returned and the stack frame containing env has been non-compliant coding example, an automatic variable is used as an argument to {{putenv()}} \[[Dowd 06|AA. C References#Dowd 06]\]. The {{TEST}} environment variable may take on an unintended value if it is accessed once {{func()}} has returned and the stack frame containing {{env}} has been recycled. |
| Wiki Markup |
|---|
Note that this example also violates rule \[[DCL30-C. Declare objects with appropriate storage durations]\]. |
...
| Wiki Markup |
|---|
\[[Open Group 04|AA. C++ References#Open Group 04]\] The putenv() function
\[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\] Section 6.2.4, "Storage durations of objects," and Section 7.20.3, "Memory management functions"
\[[Dowd 06|AA. C References#Dowd 06]\] Chapter 10, "UNIX Processes" (Confusing putenv() and setenv())
\[[DCL30-C. Declare objects with appropriate storage durations]\] |