Skip to content

Commit 049c20f

Browse files
committed
Minor documentation updates
1 parent bdc6020 commit 049c20f

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Conceptually, MessagePack stores data similarly to JSON: they are both composed
8989

9090
- Binary data is not supported by JSON at all. Small binary blobs such as icons and thumbnails need to be Base64 encoded or passed out-of-band.
9191

92-
The above issues greatly increase the complexity of the decoder. Full-featured JSON decoders are quite large, and minimal decoders tend to leave out such features as string unescaping and float parsing, instead leaving these up to the user or platform. This can lead to hard-to-find and/or platform-specific bugs. This also significantly decreases performance, making JSON unattractive for use in applications such as mobile games.
92+
The above issues greatly increase the complexity of the decoder. Full-featured JSON decoders are quite large, and minimal decoders tend to leave out such features as string unescaping and float parsing, instead leaving these up to the user or platform. This can lead to hard-to-find platform-specific and locale-specific bugs. This also significantly decreases performance, making JSON unattractive for use in applications such as mobile games.
9393

9494
While the space inefficiencies of JSON can be partially mitigated through minification and compression, the performance inefficiencies cannot. More importantly, if you are minifying and compressing the data, then why use a human-readable format in the first place?
9595

src/mpack-config.h.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@
178178
*
179179
* This automatically detects -Os with GCC/Clang. Unfortunately there
180180
* doesn't seem to be a macro defined for /Os under MSVC.
181+
*
182+
* This feature is currently experimental and may be removed in a
183+
* future release.
181184
*/
182185
#ifndef MPACK_OPTIMIZE_FOR_SIZE
183186
#ifdef __OPTIMIZE_SIZE__

src/mpack/mpack-platform.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ extern "C" {
156156
* - functions declared inline only in builds optimized for speed (MPACK_INLINE_SPEED)
157157
*
158158
* MPack does not use static inline in header files; only one non-inline definition
159-
* of each function should exist in the final build. This reduces the binary size
159+
* of each function should exist in the final build. This can reduce the binary size
160160
* in cases where the compiler cannot or chooses not to inline a function.
161161
* The addresses of functions should also compare equal across translation units
162162
* regardless of whether they are declared inline.
@@ -250,10 +250,10 @@ extern "C" {
250250
* In release mode, mpack_assert() is converted to an assurance to the compiler
251251
* that the expression cannot be false (via e.g. __assume() or __builtin_unreachable())
252252
* to improve optimization where supported. There is thus no point in "safely" handling
253-
* the case of this being false. Writing mpack_assert(0) rarely makes sense;
254-
* the compiler will throw away any code after it. If at any time an mpack_assert()
255-
* is not true, the behaviour is undefined. This also means the expression is
256-
* evaluated even in release.
253+
* the case of this being false. Writing mpack_assert(0) rarely makes sense (except
254+
* possibly as a default handler in a switch) since the compiler will throw away any
255+
* code after it. If at any time an mpack_assert() is not true, the behaviour is
256+
* undefined. This also means the expression is evaluated even in release.
257257
*
258258
* mpack_break() on the other hand is compiled to nothing in release. It is
259259
* used in situations where we want to highlight a programming error as early as

src/mpack/mpack-writer.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ typedef struct mpack_writer_t mpack_writer_t;
6161

6262
/**
6363
* The mpack writer's flush function to flush the buffer to the output stream.
64-
* It should flag an appropriate error on the writer if flushing fails.
64+
* It should flag an appropriate error on the writer if flushing fails (usually
65+
* mpack_error_io.)
6566
*
6667
* The specified context for callbacks is at writer->context.
6768
*/
@@ -169,7 +170,8 @@ void mpack_writer_init_file(mpack_writer_t* writer, const char* filename);
169170
* @def mpack_writer_init_stack(writer, flush, context)
170171
* @hideinitializer
171172
*
172-
* Initializes an mpack writer using stack space.
173+
* Initializes an mpack writer using stack space as a buffer. A flush function
174+
* should be added to the writer to flush the buffer.
173175
*/
174176

175177
#define mpack_writer_init_stack_line_ex(line, writer) \

0 commit comments

Comments
 (0)