Archived issue #0023557

V547 Expression 'as1.ToCString() != ""' is always true. To compare strings you should use strcmp() function. qabugs_3.cxx,

CommunityOCCT:DRAWclosed0 public notes

Search issues

Description

In lines 1005 and 1008:

as1.ToCString() != ""
as2.ToCString() != ""

the conditions is always true, because pointers are compared.

Was this intended?
What is the intention of the method?

Some comment on that:
"
char *s ....
if (s == "Abcd")

This code still can print "TRUE" when the 's' variable and Test() function are defined in one module. The compiler does not produce a lot of identical constant strings but uses one string. As a result, the code sometimes seems quite operable. However, you must understand that this code is very bad and you should use special functions for comparison."

Public activity

No public notes

Participants are labeled by their role within this record.

Related records