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

  • Home
  • SEARCH
  • 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 6059401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:42:22+00:00 2026-05-23T08:42:22+00:00

I am working on a software project and have found numerous examples where find_first_of(),

  • 0

I am working on a software project and have found numerous examples where find_first_of(), find_first_not_of(), find_last_of(), and find_last_not_of() are incorrectly used. These std::string methods take a string argument for a set of characters to search for whereas, the developer really means to use compare(), find(), or rfind() which take a string argument for a string to search for.

Now it would be great to educate everyone and never have this occur again, however, I would like to create a code inspector to identify suspect usages and flag them for review to attempt to semi-automate the resolution of this issue in a semi-general fashion.

I’m looking for good heuristics to find most issues with few false positives. What regular expression search patterns might work, or can someone think of other suggestions to attempt to automate the solution to this issue to get most occurrences?

Please no snappy answers about hiring better developers or the like, I wish to ameliorate the situation given the resources available.

  • 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-05-23T08:42:23+00:00Added an answer on May 23, 2026 at 8:42 am

    This may actually be a situation where you need to visually inspect every call to find_first_of and friends. It doesn’t seem like there would normally be a lot of calls, and you can tag them in some way as you verify that they are correct. By inspecting all the calls you have confidence that the existing issues are resolved.

    The only heuristic I can imagine is that if the “compare to” string is not a literal or constant it’s more likely to be incorrect.

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

Sidebar

Related Questions

I am working on a software project and have written a validation system to
With reference to the Software Project I am currently working on . I have
On the current project I'm working on, we have the following problem. Our software
I'm working on a software project which several members are working from home and
I am working on a software development project that uses code written primarily in
I am working with a team that works on a very large software project,
I'm working on a free software (bsd license) project with others. We're searching for
I've started working on a fairly complicated software. It is for a personal project,
I'm trying to set up autoconf for my project. I have everything working properly
I have a project i've been working on that requires me to retrieve the

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.