I beg to heartily differ. *No* C compiler will evaluate a call to strlen
at compile time, even if the string is compiletime evaluatable.

The best you can hope to do with a compile-time constant is to use sizeof
-1 as in

#define MYSTR "MyString"

if ( (sizeof MYSTR) - 1 ) == strlen ( target ) ) ...

The strlen call is *definitely* a run-time call. The best you can hope to
get (e.g., gcc) is that is will be transformed into an inline call.

-- 
-Time flies like the wind. Fruit flies like a banana. [EMAIL PROTECTED]
-Stranger things have happened but none stranger than this. Steven W. Orr-
Does your driver's license say Organ Donor?Black holes are where God \
-------divided by zero. Listen to me! We are all individuals!---------

On Tue, 4 Apr 2000, Bill Freeman wrote:

=>Steven Orr writes:
=>
=>> Hold on there Buffalo Bob! There is no big difference between a strlen and
=>> a strcmp.
=>
=>Actually, there usually is.  Most C compilers (possibly even the pre-
=>processor) evaluate strlen of a constant string at compile time.
=>
=>                                                      Bill
=>


**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to