Skip to main content
2 votes
0 answers
77 views

I came up with a C++11 implementation of an std::any-like thing. It works according to my testing, but I'm concerned that I might be invoking undefined behavior somewhere without realizing. I'm ...
Shahar Nacht's user avatar
4 votes
3 answers
146 views

I was trying to calculate square root of numbers without including math.h. I thought I could cast a double as a long as they both are 64 bits (in the function magnitude()) : #define NUMBER -2 #include ...
uran42's user avatar
  • 775
1 vote
1 answer
118 views

(Continuing from: Cast to custom class in PowerShell) I would like to build a custom cast like: class CheckBox { [Nullable[Bool]]$NullableBool CheckBox([Nullable[Bool]]$NullableBool) { $this....
iRon's user avatar
  • 24.7k
Best practices
0 votes
0 replies
81 views

I got the following Android UI-code: OutlinedTextField(value = mainVM.srcAmount.doubleValue.toString(), onValueChange = { // Implicit generated argument 'it' is a String. mainVM.setAmount(...
mewi's user avatar
  • 855
3 votes
4 answers
342 views

I am currently trying to generate a random float number in C. And apparently that is a hard thing to do as there seems to be no real library for it, only workarounds with rand() from stdlib, but those ...
Sebastian Fiault's user avatar
1 vote
4 answers
174 views

I'm new to pointers and trying to wrap my head around how casting and dereferencing should function in comparator functions that qsort takes. My understanding is these always have the signature int ...
St. Barth's user avatar
  • 113
Advice
1 vote
4 replies
51 views

Type Checking Challenge for AmiNode I have an interesting challenge when parsing *.ami files. I use the following recursive type, which has arbitrary hierarchical depth: AmiName = NewType("...
David Banas's user avatar
  • 2,078
1 vote
2 answers
179 views

For context, I have a function to print some text, which naturally takes in a ⁨const char *const *⁩ as one of its arguments (meaning the provided text will not be modified in any way by the function). ...
lzg's user avatar
  • 123
3 votes
2 answers
114 views

I was setting up gdb on vscode on windows and it wasn't working. I soon found out that it was erroring giving me a SIGSEGV segfault. I tried gdb in powershell with the same problem. I run the program ...
whether nar amr's user avatar
0 votes
1 answer
205 views

This is a real example from 7z latest source code; it is in the file C/LzmaEnc.c, inside a function LzmaEncProps_Normalize(), at lines 70-110, namely, on line 86: void LzmaEncProps_Normalize(...
RaySolva's user avatar
  • 109
1 vote
2 answers
167 views

I would like to know the proper way to get the following code to work. With inheritance, you can call the function of a parent pointer and execute the child function. But, if there are two parent ...
Foivos Antoulinakis's user avatar
2 votes
1 answer
167 views

I need to set the result from std::put_time from ctime into a std::string, how do I do this ? Here is my code: BBToolkit::LogManager::LogManager() { auto t = std::time(nullptr); auto tm = *std:...
joris studios's user avatar
1 vote
2 answers
216 views

I have a situation similar to described in a blog post: a visible inline member function is called from several shared libraries which are built potentially with different compilers or compiler ...
Fedor's user avatar
  • 25.6k
2 votes
3 answers
261 views

I'm trying to display the contents of some allocated memory byte by byte: #include <stdio.h> #include <stdlib.h> typedef struct { int len; int* vec[]; } vec_t; int main(void) { int ...
Mecki's user avatar
  • 99
1 vote
1 answer
162 views

I'm facing an AlignmentMismatch error while trying to cast a Vec<u8> to Vec<T>, where T is a struct that uses repr(C) and Pod + Zeroable. I've also tried the slice road &[u8] -> &...
Sigma Octantis's user avatar

15 30 50 per page
1
2 3 4 5
1338