mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 00:47:28 +01:00
Add doc/note/zero-initialization.md
This commit is contained in:
1 parent
cb7e9e0ce9
commit
f10849d20b
4 files changed
+65
-32
No files matched your search
@@ -109,21 +109,8 @@ extern "C" {
|
||||
// that the buffer is contained by the receiver struct, as opposed to being
|
||||
// passed as a separately allocated "work buffer".
|
||||
//
|
||||
// With or without this bit set, the Wuffs compiler still enforces that no
|
||||
// reads or writes will overflow internal buffers' bounds. Even with this bit
|
||||
// set, the Wuffs standard library also considers reading from an uninitialized
|
||||
// buffer to be a bug, and strives to never do so, but unlike buffer overflows,
|
||||
// it is not a bug class that the Wuffs compiler eliminates.
|
||||
//
|
||||
// For those paranoid about security, leave this bit unset, so that
|
||||
// wuffs_foo__bar__initialize will initialize the entire struct value to zeroes
|
||||
// (unless WUFFS_INITIALIZE__ALREADY_ZEROED is set).
|
||||
//
|
||||
// Setting this bit (avoiding a fixed-size cost) gives a small absolute
|
||||
// improvement on micro-benchmarks, mostly noticable (in relative terms) only
|
||||
// when the actual work to do (i.e. the input) is also small. Look for
|
||||
// WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED in
|
||||
// https://github.com/google/wuffs/blob/master/doc/benchmarks.md for numbers.
|
||||
// For more detail, see:
|
||||
// https://github.com/google/wuffs/blob/master/doc/note/zero-initialization.md
|
||||
#define WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED \
|
||||
((uint32_t)0x00000002)
|
||||
|
||||
|
||||
Reference in new issue
Block a user