C++
attribute specifiers
add metadata to declarations and definitions.
The metadata can be used by the compiler and by the developer to help understand the code intent.
Commonly used C++17 attributes such as
[[maybe_unused]]
and
[[fallthrough]]
suppress compiler warnings and signal developer intent for clarity.
C++20 attributes such as
[[likely]] and [[unlikely]]
may be used by the compiler to optimize compilation, and also provide human code readers insight into the intent of the algorithm.
GCC ≥ 5
feature test macro
__has_cpp_attribute()
checks if an attribute is supported by the compiler–even if the command line specified standard is older.
To enable code to fallback to no attribute with older compilers, use [[maybe_unused]] attribute in declaration AND in the definition to be compatible with GCC:
On non-Windows systems, the compiler would have issued a warning about y being an unused argument.
The [[maybe_unused]] attribute suppresses that warning.
The [[fallthrough]] attribute is used to indicate that a fall-through in a switch statement is intentional.
This attribute can be used to suppress warnings about missing break statements in a switch block.
When using
cmake_path(GET in PARENT_PATH out)
to manipulate paths in CMake, be cautious about trailing slashes.
The usual intent is to get the parent directory of a given path.
If the trailing slash is not stripped, the same directory is returned, which may be unexpected.
To give secure access to private GitHub repositories on less-trusted systems like CI or HPC or shared workstation, consider
GitHub Oauth tokens.
The Oauth token can give read-only (or other fine-grained permissions) to all or a specific subset of repositories the GitHub account has access to.
For read-only private GitHub repo access the “repo” permission group is selected.
Copy the text string token and SSH into the remote system where access is desired.
Configure the global user Git config to use the Oauth token for the desired GitHub organization or user.
Suppose a coworker with GitHub username “my1friend” has a private GitHub repo “myrepo”.
Have “my1friend” add your GitHub username as a collaborator in the “myrepo” settings.
Create a GitHub Oauth classic token with the “repo” permission group.
Copy and paste that token string into the laptop or workstation you’ll use to access the private repo like:
Use git remote -v in the Git repo or Git submodule to ensure old information in ~/.gitconfig is not overriding the new API token.
If a Git submodule won’t clone due to incorrect token credentials, try Git cloning the submodule repository itself in another directory to see if the old credential are slipping in somewhere.
CMake can set per-language compiler flags scoped to directory or target.
The directory scope propagates to targets in the directory and subdirectories.
Per-language options that are intended for all targets in the project are often set near the beginning of the top-level CMakeLists.txt, before any targets are declared.
The same concepts and scope apply to
compile definitions
and
linker flags.
By default,
add_compile_options()
and target_compile_options() add flags for all target languages.
Multi-language targets (for example, a target that has C and C++ source files) would have the flags applied to all languages.
In general, this may cause problems if the flags are not appropriate for all languages.
The options are restricted by compiler, language, build configuration, etc. using CMake
generator expressions.
For example, $<COMPILE_LANGUAGE:Fortran> is used to restrict options to Fortran targets.
A stanza like $<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug,RelWithDebInfo>> sets flags for Fortran targets in the debug and RelWithDebInfo build configurations.
Note: where using
FetchContent,
the main project may desire -Wall but this may cause megabytes of warnings from a legacy Fetched project.
A solution is to put add_compile_options() in each of the parent project directories and/or use target_compile_options() in the parent project.
This example is for a C and Fortran project, where some flags apply to C and Fortran, and other flags are Fortran-specific.
It’s often useful to use a convenience function to make the code more readable, say in a file “AddOptions.cmake”:
project(DemoLANGUAGESCFortran)include(AddOptions.cmake)add_compile_lang_options(Fortran-Wall-fimplicit-none)# more advanced example to add debug-only, compiler-specific and language-specific options:
add_compile_options(
$<$<AND:$<COMPILE_LANG_AND_ID:Fortran,GNU>,$<CONFIG:Debug,RelWithDebInfo>>:-Werror=array-bounds>)
FFmpeg can
merge
several files each containing one audio channel into a single file with multiple channels.
For example, a multichannel data collection might save each sensor channel into individual files.
For data analysis and for practicality to avoid mixing channels from different experiments, it can be useful to combine the individual channel files into a single multichannel file.
The
amerge
filter can merge multiple files into a single multichannel file. .
The amerge filter requires all input files to have the same sample rate and format.
have preprogrammed FM mode with CTCSS squelch on “President P channels”.
Similar to some OEM FRS / GMRS radios that have preprogrammed channels with CTCSS or DCS codes, the P channels are a convenience that immediately allow users with CB radios having FM and CTCSS to interoperate with each other.
We welcome preprogrammed P channel-like features with FM and CTCSS as they are likely to increase usage of FM mode and CTCSS on CB radios.
This gives the benefits of maximum range with minimum interference.
Before these preprogrammed channels, setting
CB radio CTCSS coded squelch
involved diving through menus.
The CB radio channel to President P channel mapping is:
President P channel
CB channel
Center Frequency (MHz)
1
1
26.965
2
3
26.985
3
11
27.085
4
18
27.175
5
24
27.235
We wonder if the P channel choices included user feedback or CB radio spectrum use observations.
The commentary following is based on North American CB radio usage observations.
The lower CB channels are historically less frequently used due in part to adjacent channel splatter from CB channel 6 and 11 that are partially used by DX operators.
High power stations with clipped AM modulation that splatters adjacent channels have a lower duty cycle based on the human voice.
Using FM mode with coded squelch experiences much less disturbance from adjacent channel splatter versus the AM mode with signal squelch.
P channel 1 (CB channel 1) on FM mode may have less interference than the other P channels in many areas.
P channel 2 (CB channel 3) is 40 kHz away from CB channel 6 with the highest power operators and is likely also as good as P channel 1 for interference.
P channel 3 (CB channel 11) is a popular AM mode channel. FM users (even with coded squelch) may experience reduced communications range due to co-channel interference from AM mode users.
P channel 4 (CB channel 18) is adjacent (10 kHz away) from CB channel 19, which is a popular AM mode channel for truckers and highway travel.
P channel 5 (CB channel 24) may like P channels 1 and 2 have less interference than P channels 3 and 4.
Although it may be impossible to change the existing radio P channel frequencies, we would suggest OEMs consider adding the P channel frequencies for future radios: CB channels 2, 8, 12, 27, 29.
These frequencies
avoid:
DX users (CB channels 6, 11, 26, 28), handheld (CB channel 14), off-road users (CB channel 4), and SSB users (CB channels 16, 30-40).
While dedicated NOAA NWR weather (WX) radios are available, two-way communications radios such as CB radio and GMRS etc. can also have 162 MHz weather radio receivers.
162 MHz WX radio is a one-way radio service that broadcasts weather information and emergency alerts across much of the USA, Canada, and Mexico.
When determining which WX channel to receive on, it can be confusing because there is no standard WX channel number to 162 MHz frequency mapping.
Use the NOAA
USA search
or
Canada search
to find nearby WX radio transmitter frequencies.
Channel number to frequency mapping: a common practice is to start with the lowest frequency and go up across the 7 WX radio frequencies.
This is perhaps the most common channel number to frequency mapping.
WX Channel
Frequency (MHz)
1
162.400
2
162.425
3
162.450
4
162.475
5
162.500
6
162.525
7
162.550
Non-sequential channel order is used by some CB radios such as Radioddity / Anytone radios made by Qixiang.
WX Channel
Frequency (MHz)
1
162.550
2
162.400
3
162.475
4
162.425
5
162.450
6
162.500
7
162.525
Comparing the reception performance on a known frequency vs. a handheld radio can give a quick indication that an antenna system is working OK–even if like 27 MHz CB radio the designed antenna frequency is far from the 162 MHz weather radio frequency.
Comparing WX radio reception on a CB radio with base or mobile antenna versus a handheld radio on the same 162 MHz WX radio frequency indicates that the CB radio antenna coax is perhaps not severely damaged or lossy, and the radio is working OK.
Modern sub-$250 television receivers make compromises in low cost hardware while supporting the best possible picture quality for internet streams.
This can lead to compromises in fundamental performance for over-the-air (OTA) reception of digital ATSC TV signals.
For example, the ability to monitor signal strength is often not present in such low-cost TVs.
When a channel(s) that should be easily received is not available, the fundamental step of checking signal strength might be unavailable on a low-cost TV.
A first step is generally to rerun the channel scan with the antenna (if indoor) positioned in a window facing the
transmitter direction.
A diagnostic tool and possible solution is an ATSC tuner connected to the TV via HDMI.
ATSC 1.0 HDMI tuners are available for under $30.
The dedicated tuner may be of higher quality than the TV’s built-in tuner, and may provide a signal strength reading.
Check product reviews to ensure the tuner is of good quality and has a signal strength meter.
Some tuners can connect to an Android device or laptop via USB to receive broadcasts or monitor signal strength.
This can allow a technically-minded user to diagnose reception issues including interference.
The C23 standard requires function declarations to have the arguments specified, else (void) (zero arguments) is assumed.
This is a
breaking change
for code that didn’t use the best practice of specifying the argument types in the function declaration.
A real life
example
of upgrading a large project (Red Hat Linux) to C23 compliance is illustrative.
This change emphasizes the importance of adhering to recent C standards for clarity while maintaining compatibility with older language standards if possible.
Freezing the compiler version range for project code is generally a costly long-term strategy as technical debt and developer frustration accumulate.
Newer compilers keep adding
debugging features
and performance improvements.