home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- Path: sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!physik.tu-muenchen.de!berg
- From: berg@physik.tu-muenchen.de (Stephen R. van den Berg)
- Subject: strcmp() on a non-nil-terminated string
- Message-ID: <1992Nov16.162313.3334@Urmel.Informatik.RWTH-Aachen.DE>
- Originator: berg@tabaqui
- Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
- Nntp-Posting-Host: tabaqui
- Organization: Rechnerbetrieb Informatik / RWTH Aachen
- Date: Mon, 16 Nov 92 16:23:13 GMT
- Lines: 22
-
- Suppose I have the following program:
-
- --------------------------------------
- #include <string.h>
-
- char first[]="first";
- char second[]={'s','e','c','o','n','d'};
-
- main()
- { return!!strcmp(first,second);
- }
- --------------------------------------
-
- Is this program allowed to behave undefined? If so, can anyone imagine
- provide an example when this might happen?
-
- You would expect a sane implementation to return with an exitcode of 1.
- --
- Sincerely, berg@pool.informatik.rwth-aachen.de
- Stephen R. van den Berg (AKA BuGless). berg@physik.tu-muenchen.de
-
- "Be spontaneous!"
-