On Wed, Dec 05, 2018 at 07:03:53PM -0600, Jacob Bachmeyer wrote:

> Older versions of Tcl may have required this use of [string match],
> but modern Tcl allows the much simpler "==" operator.  According to
> time(n), "==" is also slightly faster in "if" expressions in
> addition to being more robust against "odd" inputs.

On the contrary, using '==' is very problematic because it treats the
strings as numerial arguments. Consider:

% set str 0x10
0x10
% if {$str == "16"} { puts yes }
yes

Furthermore, you shuld use 'string equals' for literals as 'string
match' permits patterns.

Cheers,
Ben

Attachment: signature.asc
Description: PGP signature

_______________________________________________
DejaGnu mailing list
DejaGnu@gnu.org
https://lists.gnu.org/mailman/listinfo/dejagnu

Reply via email to