Results for “Binary values & packets”
Small, practical examples. Search by task or narrow things down below.
Propagate a parsing error with question mark
Propagate a parsing error with question mark in a complete Rust program using the standard library.
Rust✓ Tested
Provide a default for a missing value
Provide a default for a missing value in a complete Rust program using the standard library.
Rust✓ Tested
Quote a CSV field and double embedded quotes
C: A quoted CSV field represents a quote character by repeating it.
C✓ Tested
Read a big-endian integer from bytes
Read a big-endian integer from bytes using a complete Go program with explicit sample inputs.
Go✓ Tested
Read a file length in bytes
Java: Files.size inspects metadata without loading the file into a Java string.
Java✓ Tested
Read a variant only when it holds the expected type
C++: get_if returns a null pointer rather than throwing for another active alternative.
C++✓ Tested
Read an optional JSON property safely
C#: Use TryGetProperty instead of throwing when an optional property is absent.
C#✓ Tested
Remove a map entry and inspect the number removed
C++: erase by key reports whether a unique-key map contained the entry.
C++✓ Tested
Represent an absent result with optional
C++: value_or supplies a default without requiring a sentinel inside the value domain.
C++✓ Tested
Run cleanup through a scoped destructor
C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.
C++✓ Tested
Search a sorted array efficiently
C#: Array.BinarySearch requires an array sorted with the same comparison rules.
C#✓ Tested
Search a sorted array with bsearch
C: The search uses the same ordering comparator as the sorted input.
C✓ Tested