Skip to content

Commit 0d7a975

Browse files
committed
Fixed error in README
1 parent 01f839b commit 0d7a975

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ I needed a way to buffer sensor events for a group engineering IOT project that
88
I decided to give object oriented programming a shot using only C (no C++) with this library, of course, it still compiles with C++ compilers such as in the Arduino IDE. Using C structs and function pointers, the library creates RingBuf objects that are complete with their own methods and attributes. Note that every method (except constructor), takes a `RingBuf *self` pointer. This is the equivalent of the `this` pointer in C++, but the C++ compiler automatically passes it behind the scenes. For this library, you must manually pass a the `RingBuf *self` pointer as the first argument.
99

1010

11-
## But I like C++'s object syntax... :(
11+
## But I like C++'s object syntax...
1212

13-
Fine. I reluctantly wrapped the C in a C++ class called `RingBufC`. All the methods are the same, except you no longer have to pass the this/self pointer. You can use either.
13+
Fine. I reluctantly wrapped the C stuff in a C++ class called `RingBufC`. All the methods are the same, except you no longer have to pass the this/self pointer. You can use either.
1414

1515
```
1616
// If you want to use C...
17-
17+
char *mystr = "I like C";
1818
RingBuf *buf = RingBuf_new(sizeof(char*), 100);
19-
buf->add(buf, "I like C.");
19+
buf->add(buf, &mystr);
2020
```
2121

2222
```
2323
// If you want to use the C++ wrapper
24-
24+
char *mystr = "C++ has pretty object.method() syntax";
2525
RingBufC buf(sizeof(char*), 100);
26-
buf.add("C++ has pretty object.method() syntax");
26+
buf.add(&mystr);
2727
```
2828

2929

0 commit comments

Comments
 (0)