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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:04:36+00:00 2026-06-07T06:04:36+00:00

I’m having trouble finding any information regarding the following warning when linking a dynamic

  • 0

I’m having trouble finding any information regarding the following warning when linking a dynamic library:

In function `MyClass::myfunc()':
MyClass.cpp:(.text+0x14e4): warning: memset used with constant zero length parameter; this could be due to transposed parameters

Here is an excerpt of myfunc:

void MyClass::myfunc() {
    vector<Variable*>::const_iterator it;

    for (it = m_vars.begin();
         it != m_vars.end();
         ++it) {
        if ((*it)->recordme) {
            MyRecord* r = new MyRecord(*it);
            initMyRecord(*r);
            m_records.push_back(r);
        }
    }
}

So I’m pretty much stuck on were should I be looking for possible causes for this memset. The call to the new operator is my first suspect, but I’m not even sure if it’s worth looking for this. I’m not sure either if I should take this warning seriously or let it pass.

Question: what should I do about this warning? And what kind of patterns should I look out for in order to assure that I’m not going to shoot myself in the foot later?

Update:
Here is the MyRecord constructor, which is in a header file, so it might or might not be inlined, if I understand correctly.

class MyRecord {
public:
    MyRecord(const Variable* var) :
        buffer(0),
        lastSave(-1 * std::numeric_limits<double>::max()),
        sample(100),
        bufsize(100),
        gv(var),
        rec_function(0)
    {};
    virtual ~Record() {
        if (rec_function)
            delete rec_function;
        rec_function = 0;
    };

private:
    Record(const Record&);
    Record& operator=(const Record& rec);

public: // @todo: remove publicness
    boost::circular_buffer< boost::tuple<double,boost::any> > buffer;
    double lastSave;
    double sample;
    unsigned int bufsize;
    const Variable* gv;
    RecordFunctor* rec_function;
};

The RecordFunctor is a pure-virtual struct:

struct RecordFunctor {
    virtual ~RecordFunctor() {};
    virtual void record(const double) = 0;
};

Additional info? I’m compiling with flags -O2 and g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

  • 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-07T06:04:37+00:00Added an answer on June 7, 2026 at 6:04 am

    You are calling the boost::circular_buffer constructor with a capacity of 0. This probably causes that constructor to call memset() to initialise the storage used by the circular buffer, but you’ve told it you want a buffer of zero size.

    The solution is to give the circular_buffer constructor the actual size you want, not zero (zero doesn’t make sense).

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I have a view passing on information from a database: def serve_article(request, id): served_article
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.