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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:17:42+00:00 2026-05-28T00:17:42+00:00

There is an Arduino library called ‘ByteBuffer’ (found here ), which is a circular

  • 0

There is an Arduino library called ‘ByteBuffer’ (found here), which is a circular buffer implementation. I modified it slightly (calling it ‘ByteBufferPro’), by chopping off support for all non-byte data-types, and adding few convenience methods. I intend to use this in my Interrupt-Service-Routine, that is already doing some heavy-lifting. To relieve some bit of workload on the ISR, I intend to let the ISR push bytes of information on the circular-buffer (since capturing/storing them is time-critical), but actual processing of that information is not as time-critical, which I do in the main loop().

Following the logic that any variable that can be updated in ISR should have the ‘volatile’ qualifier in declaration, I did declare the buffer as volatile, but now I am seeing these compilation errors:-

ByteBufferProExample.cpp: In function 'void setup()':
ByteBufferProExample:12: error: passing 'volatile ByteBufferPro' as 'this' argument of 'void ByteBufferPro::init(unsigned int)' discards qualifiers
ByteBufferProExample.cpp: In function 'void loop()':
ByteBufferProExample:24: error: passing 'volatile ByteBufferPro' as 'this' argument of 'void ByteBufferPro::clear()' discards qualifiers

Wondering as to what is the reason, and how I might fix this ? Taking the cribbage being about ‘this’ pointer, I have a feeling that if I turn the implementation of ByteBuffer from C++ to a C one (OO to procedural), that should be an easy way to fix it, although I really like the OO semantics. Would do so, if there is no other way.

  • 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-28T00:17:42+00:00Added an answer on May 28, 2026 at 12:17 am

    All of your functions should have volatile qualifier, just like const qualifier needed for constant objects. Here is an example:

    class A
    {
    public:
        A(unsigned int a)
        {
        }
    
        void init() volatile
        {
            cout << "A::init()" << endl;
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just bought an Arduino WiFi shield called "RedFly", which support WPA-TKIP but my
There are numerous Agile software development methods. Which ones have you used in practice
I have a simple Arduino sketch that spans several files. There is a function
There is an application written in PHP which I am converting to Ruby. When
I'm using an Arduino with the Firmata library for communication to a C# application,
I am trying to write a class for an Arduino library. I am having
Besides Arduino , what other ways are there to learn hardware programming in a
Is there a table summarizing the differences of CPUs supported by Arduino? What's the
I wanted to learn .NET Microframework and found that there is (among others) Netduino
As you may have seen, there is another super cheap phone (Nokia 100) which

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.