Results for “Structures & function interfaces”
Small, practical examples. Search by task or narrow things down below.
Measure the length of ordinary text
SQLite: Use the engine’s text-length function; this ASCII example has no trailing spaces.
SQLite✓ Tested
Narrow a union using typeof
Handle text and numeric values with separate branches.
union✓ Tested
Number rows within each group
Assign ordered row numbers with a window function.
row_number✓ Tested
Parse a short option with getopts
Read a named option and handle invalid flags explicitly.
getopts✓ Tested
Pass named parameters from a hashtable
Keep a command’s options together in a reusable object.
splatting✓ Tested
Read a byte lookup table from flash
Arduino / C: PROGMEM tables require the AVR program-memory access functions.
Arduino / C✓ Tested
Read the kind of command being invoked
PowerShell: CommandType distinguishes cmdlets from functions, aliases, and external applications.
PowerShell✓ Tested
Remove one handler without removing others
jQuery: Pass the original function reference to off.
jQuery✓ Tested
Rename a known file
C: The standard rename function reports failure through its return value.
C✓ Tested
Round a halfway floating-point value
C: The C round function rounds halfway cases away from zero.
C✓ Tested
Select the top row in each group with a tie-breaker
SQL: Filter an outer query on ROW_NUMBER because window functions are not evaluated in WHERE.
SQL✓ Tested
Select the top row in each group with a tie-breaker
SQL Server: Filter an outer query on ROW_NUMBER because window functions are not evaluated in WHERE.
SQL Server✓ Tested