compare strings, strcmp
Conor P. Cahill
cpcahil at virtech.uucp
Tue Nov 21 11:31:45 AEST 1989
In article <5139 at mnetor.UUCP>, lazer at mnetor.UUCP (Lazer Danzinger) writes:
> +This macro is "unsafe" because the macro arguments a and b are used twice,
> +hence possible side effect difficulties...
> I see no possibility of side effects. What is unsafe is the
> referencing of the location where a and b point to, without
> first checking that they are not null pointers.
wrongo. you (the programmer) must do that before calling StrEqu. This macro
was designed to be a replacement for using strcmp directly and therefore has
the same requirements as the strcmp function itself. Calling
strcmp with a null pointer will result in a core dump on lots of machines
and undefined behavior on all others.
The side effects have been addressed in lots of other posts in this thread.
--
+-----------------------------------------------------------------------+
| Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 !
| Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 |
+-----------------------------------------------------------------------+
More information about the Comp.lang.c
mailing list