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 8182771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:57:41+00:00 2026-06-07T00:57:41+00:00

I just don’t get it. I have a function to read stemmed strings from

  • 0

I just don’t get it. I have a function to read stemmed strings from a List, check each string if it contains a punctuation marker to and build phrases in a loop of the single word images. When I check the string building/containing the phrase with s.length() > 0 in the if-statement I get a seg fault. Here is the function:

std::wstring
Phrase::userFriendlyTerms() {
    std::wstring s = L"";

    List<Object> *terms = getTerms();

    Iterator<Object> *i = terms->iterator();
    for (; i->hasNext();) {
        StemmedTerm *t = (StemmedTerm *) i->next();
        std::wstring image = t->getTerm();

        // --- gdb shows me a seg. fault with s.length()
        if (s.length() > 0 &&
            !((image.compare(L",") == 0) || (image.compare(L"?" == 0))
                || (image.compare(L"!") == 0)
                || (image.compare(L";") == 0))) {
            s.append(L" ");
        }
        s.append(image);
    }   
    delete i;

    return s;
}

Exact error message is:

Program received signal SIGSEGV, Segmentation fault.
__wcslen (s=0x0) at wcslen.c:30
30  wcslen.c: No such file or directory.
    in wcslen.c
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) backtrace
#0  __wcslen (s=0x0) at wcslen.c:30
#1  0x00007ffff7b89e56 in std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::compare(wchar_t const*) const () from /usr/lib/libstdc++.so.6
#2  0x00000000004833ed in Phrase::userFriendlyTerms (this=0x1425ac0) at algorithm/Phrase.cpp:56

Maybe I am blind or missing something …

Thanks for your help!

  • 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-07T00:57:43+00:00Added an answer on June 7, 2026 at 12:57 am

    this here looks suspicious

    (image.compare(L"?" == 0)
    

    are you sure you didn’t mean

    (image.compare(L"?") == 0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just don't get it, class MyClass { const constant = 'constant value'; function
There's something I just don't get about guice: According to what I've read so
Maybe I just don't know enough about structs and have been using them blindly
I have a question that I just don't feel like I've found a satisfactory
I just don't get it: when I use the camera with an intent and
There's something I just don't get regarding config files and dev or prod environments.
I just don't get it where is the problem but here's the error: Fatal
Ok i just don't have enough knowledge for this simple script apparently. Basically, in
One thing about Oracle Apex that I just don't get is the lack of
I don't get it. i am a newbie to objective c and i just

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.