mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-09-28 07:50:54 +02:00
Updated FAQ (markdown)
8
FAQ.md
8
FAQ.md
@@ -155,7 +155,7 @@ See [ArduinoJson: Avoiding pitfalls](https://github.com/bblanchon/ArduinoJson/wi
|
|||||||
|
|
||||||
`StaticJsonBuffer` and `DynamicJsonBuffer` are designed to be throwaway memory pools, they are not intended to be reused.
|
`StaticJsonBuffer` and `DynamicJsonBuffer` are designed to be throwaway memory pools, they are not intended to be reused.
|
||||||
|
|
||||||
If you beleive you need to reuse a `JsonBuffer`, it's because [you're not using the library correctly](https://github.com/bblanchon/ArduinoJson/wiki/FAQ#whats-the-best-way-to-use-the-library).
|
If you believe you need to reuse a `JsonBuffer`, it's because [you're not using the library correctly](https://github.com/bblanchon/ArduinoJson/wiki/FAQ#whats-the-best-way-to-use-the-library).
|
||||||
|
|
||||||
##### 1. There is a reason behind this.
|
##### 1. There is a reason behind this.
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ And in this case `myObject` and `myArray` would point to the exact same location
|
|||||||
Therefore, any modification of one would corrupt the other.
|
Therefore, any modification of one would corrupt the other.
|
||||||
|
|
||||||
That's why `StaticJsonBuffer` and `DynamicJsonBuffer` have been design to force you to use them in a scope.
|
That's why `StaticJsonBuffer` and `DynamicJsonBuffer` have been design to force you to use them in a scope.
|
||||||
If you believe you need a `clear()` function, then you're not using the library properly.
|
If you believe you need a `clear()` function, then you're not using the library correctly.
|
||||||
|
|
||||||
##### 2. Allocating a `StaticJsonBuffer` is not expensive
|
##### 2. Allocating a `StaticJsonBuffer` is not expensive
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ Use `measureLength()` to compute the number of characters that will be printed b
|
|||||||
|
|
||||||
Use `measurePrettyLength()` to compute the number of characters that will be printed by `prettyPrintTo()`.
|
Use `measurePrettyLength()` to compute the number of characters that will be printed by `prettyPrintTo()`.
|
||||||
|
|
||||||
None of these methods include the zero terminator.
|
None of these methods include the zero-terminator.
|
||||||
So if you need to allocate a buffer, don't forget to add 1 to the size.
|
So if you need to allocate a buffer, don't forget to add 1 to the size.
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
@@ -560,7 +560,7 @@ for (int i=0; i<10; i++) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
See issue [#153](https://github.com/bblanchon/ArduinoJson/issues/153) and [#160](https://github.com/bblanchon/ArduinoJson/issues/160).
|
See issue [#153](https://github.com/bblanchon/ArduinoJson/issues/153), [#160](https://github.com/bblanchon/ArduinoJson/issues/160) and [#286](https://github.com/bblanchon/ArduinoJson/issues/286).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user