Mar
13
comment How to debug a segmentation fault that occurs after the execution of a program
I'd guess it's not "after the execution of a program", it's after the last line of main in C++. Destructors and deallocations are still called. So, a classic UB like array out-of-bounds or whatever. I'd start with compiling with -fsanitize=address and fixing all UB found.
Feb
18
comment Custom string encryption works on some strings but weirdly not others?
Also, you use ISEHelpers::AllocatePointer with unknown implementation... Please make your code smaller.
Feb
18
comment Custom string encryption works on some strings but weirdly not others?
Your example is not complete/verifiable: it lacks proper includes, main, etc. It also includes excess stuff like the UXorChar function that can be replaced with return 0, non-portable __forceinline attributes. It'd be easier to answer if a reader can copy your program, compile locally without any changes, and then compare the expected output from your question with the real output.
Feb
10
comment How do I reassign a bash array element
Remove the space after =
Feb
1
comment Print the number -99'999'999'999'999.99
This number cannot be stored exactly in floating-point types like float or long double. Literally impossible. In any language that uses IEEE-754-based floating-point numbers. If you need that level of precision, either count in cents and integer types (like int64_t) or use arbitrary-precision arithmetic like Boost.Multiprecision.
Jan
26
comment String goes from normal characters to garbage for an as of yet indiscernible reason
Likely undefined behavior. Mismanaged pointers, early free or something similar. Recompile the whole project with -fsanitize=address compilation/linkage option, that should be a good place to start.
Jan
13
awarded Popular Question
Jan
2
awarded Notable Question
Jan
1
comment Pass all arguments from outer function to inner function C
If it's at least C++11, variadic templates for functions + (optionally) perfect forwarding are for the rescue.
Jan
1
comment Pass all arguments from outer function to inner function C
Also, are you sure it's C, not C++? I believe C does not have have methods like Serial.print. Unless emulated with function pointers.
Jan
1
comment Pass all arguments from outer function to inner function C
Impossible. Only enumerate all arguments manually. Or, you can use a macro like #define customPrint(...) do { Serial.print(__VA_ARGS__); } while(0) but it's its own can of worms. Or, if the function you're calling supports va_args like vfprintf, you can go with va_args/va_begin/etc
2023
Dec
15
awarded Yearling
Dec
10
comment The C++ Programming Language 4th Edition Bjarne Stroustrup - Assert example
It ignores, and then it calls the version with <>. The version with <> (templated) does not ignore current_mode or default_level.
Nov
30
awarded Revival
Nov
21
reviewed Approve suggested edit on Why am I getting "invalid syntax" from an f-string?
Nov
21
answered How to retrieve a lambda from a std::vector of std::shared_ptr
Nov
14
awarded Popular Question
Nov
7
answered Multiple user-defined conversions on initialization
Nov
6
accepted How can a big number fit precisely into `double` with 32-bit GCC?
Nov
6
comment DFS and BFS Time and Space complexities of 'Number of islands' on Leetcode
@totooooo Worst-case as in "the algorithm uses less than X bytes" - yes. Worst-case as in "the test case requires the algorithm to use at least X bytes" - no. Big-O is for upper bounds, big-omega is for lower bounds, big-theta is for exact bounds.
1 2 3 4 5