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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:16:39+00:00 2026-05-25T22:16:39+00:00

Something::methodname() { (unsigned char*) ptr = (unsigned char*) m_pptr; while ((*ptr || *(ptr+1)) &&

  • 0
Something::methodname()
{  
    (unsigned char*) ptr = (unsigned char*) m_pptr;

    while ((*ptr || *(ptr+1)) && (((unsigned char*)m_pptr+BUFSIZE)<ptr))
        ptr++;

    if(ptr == m_pptr)
        return ptr; 

    return ptr + 1;
}

m_pptr is a protected member of a class. ptr is local to this function

Could someone help me with the logic of this code? I know it compiles but the answers I’m getting out are not the ones I’m expecting. I am memset-ing a buffer full of A5’s and the while loop fails somehow. It skips right past it. Any help would be great.

This will go through a buffer and if the value of the pointer or the value of (ptr+1) is true it will increment the pointer AND the ptr can’t exceed the size of the buffer(which is found by m_pptr “pointer to the beginning of the buffer” + buffer size) has to be true also. The if statement says if m_pptr(pointer to beginning of the buffer is the same as ptr then return just the pointer.

this function returns a void* and is passed nothing

  • 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-25T22:16:39+00:00Added an answer on May 25, 2026 at 10:16 pm
     (((unsigned char*)m_pptr+BUFSIZE)<ptr))
    

    looks backward:

     (((unsigned char*)m_pptr+BUFSIZE)>ptr))
    

    would be more likely; Even more sane:

    while (ptr < ((unsigned char*) m_pptr + BUFSIZE)) // until end of buffer
    {
        if (!*ptr)      // null char reached
            break;
        if (!*(ptr+1))  // null char almost reached
            break;
    
        // do stuff
    
        ptr++;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example: I want to do this: METHODNAME(5) { // do something } which results
Is it possible to rename method in Python? Something like this class Validation(unittest.TestCase): def
Something like var life= { users : { guys : function(){ this.SOMETHING.mameAndDestroy(this.girls); }, girls
Something like this might had worked <%= Html.RouteLink(, new { controller = Article, action
In my Django project, my url.py module looks something like this: urlpatterns = patterns('',
It probably isn't possible, but I want to check if something like this can
$.ajax({ type: GET, url: 'http://services.somewhere.com/MethodName', data: { 'param1':'something', 'param2': 'somethingElse' }, cache: false, dataType:
So, I've got something along the lines of: public abstract class myClass { String
I have a class that uses XML and reflection to return Object s to
Something i've never really done before, but what is the best way to make

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.