Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8568617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:09:07+00:00 2026-06-11T18:09:07+00:00

I just have some kind of fundamental perception problem with strcmp, stricmp, compare, etc.

  • 0

I just have some kind of fundamental perception problem with strcmp, stricmp, compare, etc. I KNOW what they do and I know WHY they do it, but when I’m checking equality I just naturally write “if ( strcmp() )…” It’s backwards logic to me and it just doesn’t occur to me (until later when my code block doesn’t work) to write “if ( 0==strcmp() )…”. I do this all the time and it slows down my development. Anyone got a tip to reverse my brain on this?

It’s like I needed the function to be named “strdoesntcmp”… (yes I know that it couldn’t be used for less- or greater-than that way…). Sure I could use #define or inline to make such a thing but that’s a hack… I just want to reverse my natural thinking on it if that makes sense…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:09:08+00:00Added an answer on June 11, 2026 at 6:09 pm

    Just think, that comparison is, in fact, subbtraction (the microprocessor instructions are also working in such way). So strcmp might be called strsub, and in such way zero means that the strings are equal.

    Or implement the strcmp specification on your own. While you work it out, the return values will glue to your mind like 1x1.

    You can think also, that once you have posted to stackOverflow that you are always forgetting (0==strcmp) and got a lot of confusing answers to it. Once you have this remembered, your mind could not mistake anymore that the compare operator is not the equality operator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know if I just have some kind of blind spot or what,
I have some tabs using jQuery UI which work just fine, but I want
I just want to know that can i make an application which have some
I know this sounds confusing: I have just built some basic prev/next pagination for
I don't mean form athentication. You know how some webpage just have a popup
I have some kind ListView. All items in it are in rectangle shape, but
I have some kind of problem when adding models to my Ruby on Rails
imagine the following problem in grails you have some kind of audit trail domain
I have just switched from svn to mercurial and have read some tutorials about
I have some code I am working on that worked just fine until I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.