Re: environmental variables

From: Joona I Palaste (palaste_at_cc.helsinki.fi)
Date: 12/12/04


Date: 12 Dec 2004 16:38:55 GMT

Kenny McCormack <gazelle@yin.interaccess.com> scribbled the following:
> In article <cpc0lv$jo0$1@oravannahka.helsinki.fi>,
> Joona I Palaste <palaste@cc.helsinki.fi> wrote:
>>Satya Das <satyaranjandas77@yahoo.com> scribbled the following:
>>> /*
>>> This program should print all the environment variables.
>>> */
>>
>>Only on some implementations.
>>
>>> #include <stdio.h>
>>> int main( int argc, char *argv[], char *envp[] )
>>
>>This form of main() is non-standard and causes undefined behaviour.
>>It might work for some implementations but is not guaranteed to work
>>on any.

> Bzzzzt. It is guaranteed to work on Unix (aka, POSIX).
> This serves as a counterexample to the statement that there doesn't exist
> a system under which it is guaranteed to work.

When I say "guaranteed" I mean "guaranteed by the C standard", keeping
with the topic of this group. Implementations may guarantee what they
want, as long as it doesn't conflict with the C standard, but that's off
topic here.

-- 
/-- Joona Palaste (palaste@cc.helsinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"I am lying."
   - Anon


Relevant Pages

  • Re: file of exact size
    ... to be portable to implementations not supporting 'long long' as well. ... If I had used 'long long' and a single loop, ... not guarantee that files will be close correctly. ... malloced memory will be released upon exit of a program - although it is ...
    (comp.lang.c)
  • Re: size_t overflow
    ... is it possible that their are implementations where size_t can represent ... sizes can result in an integer overflow? ... There is no guarantee whatsoever that the total number of ... is much smaller than the length of the first string, ...
    (comp.std.c)
  • Re: Scheme closures
    ... > The problem here is that there is no guarantee that the ... The reason that implementations might choose to ... LispMe: ... you shouldn't be writing code which depends on ...
    (comp.lang.lisp)
  • Re: Bug analysis
    ... the control characters horizontal tab and new-line; ... But it's also a set of requirements on C implementations, ... a guarantee that "plain vanilla" text files will work as desired. ... all character codes can be written to and read back from any ...
    (comp.lang.c)
  • Re: Implicit int
    ... How does that guarantee help with binary compatibility? ... and the C99 standard followed. ... I know of no implementations where long long is anything other than 64 ...
    (comp.std.c)