home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- Path: sparky!uunet!elroy.jpl.nasa.gov!ucla-cs!twinsun!eggert
- From: eggert@twinsun.com (Paul Eggert)
- Subject: Re: Return values from recursive function
- Message-ID: <bknJSeCZ@twinsun.com>
- Sender: usenet@twinsun.com
- Nntp-Posting-Host: farside
- Organization: Twin Sun, Inc
- References: <1erqs4INN7aa@zeppo.uccs.edu>
- Date: Tue, 24 Nov 1992 03:08:27 GMT
- Lines: 18
-
- dbbergac@sanluis (Dave Bergacker) writes:
-
- >int streq(const char *s1, const char *s2)
- >{
- > if ( !*s1 || ( *s1 != *s2 )) return *s1 - *s2;
- > else streq(++s1,++s2);
- >}
-
- >Does ANSI specify anything about this behavior?
-
- Yes. The C Standard says the behavior is undefined.
-
- >This code worked on Borlands TC (version unknown) and gcc version 2.2.2.
-
- ``Undefined'' means the implementation can do anything it pleases -- it
- can even do what the programmer meant! An implementation need not
- diagnose this error. But you should tell your students to use their
- compilers' debugging options; e.g. `gcc -Wall' diagnoses this error.
-