Article View: comp.std.c
Article #2948strcmp() on a non-nil-terminated string
From: Stephen R. van den Berg
Date: Mon, 16 Nov 1992 16:23
Date: Mon, 16 Nov 1992 16:23
22 lines
1163 bytes
1163 bytes
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!"
Technical Details
Message-ID:
<1992Nov16.162313.3334@Urmel.Informatik.RWTH-Aachen.DE>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!physik.tu-muenchen.de!bergShow Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!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