...
Non-Compliant Code Example
Code Block | ||
---|---|---|
| ||
if (putenv("TEST_ENV=foo") != 0) {
/* Handle Error */
}
if (putenv("Test_ENV=bar") != 0) {
/* Handle Error */
}
temp = getenv("TEST_ENV");
if (temp == NULL) {
/* Handle Error */
}
printf("%s\n",temp);
|
This code behaves differently when compiled under Linux and Windows.
On a test IA-32 Linux machine with GCC Compiler Version 3.4.4 this code prints:
Code Block |
---|
foo
|
Whereas, on a test IA-32 Windows XP machine with Microsoft Visual C++ 2008 Express it prints:
Code Block |
---|
bar
|
Non-Compliant Code Example
In this non-compliant code example, the getenv
function is used to retrieve a value from the environment.
...