Most active questions

Filter by
Sorted by
Tagged with
25 votes
6 answers
20k views

I'm trying to get started with the Google Antigravity platform (the new Gemini 3 agentic IDE), and I'm hitting a wall right at the very beginning—the account setup phase. The Issue I'm Seeing: I ...
Niloy Chowhury's user avatar
Advice
1 vote
22 replies
304 views

From the man pages, I found that size_t has the range of 0 to SIZE_MAX, and ssize_t has the range of -1 to SSIZE_MAX. So, after printing those values on a 64bit system, I have the following results: ...
sat0sh1c's user avatar
11 votes
7 answers
1k views

I want to use circular queue with different types and lengths in a project which mainly consists of C code. I'm thinking about implementing the circular queue as a C++ template struct. How to expose ...
Jackoo's user avatar
  • 503
Advice
0 votes
11 replies
196 views

The following code is accepted by GCC and the resulting binary prints the expected results. But is it standard conform and would always work on different systems using different compilers? Minimal ...
Martin Fehrs's user avatar
  • 1,165
8 votes
1 answer
847 views

With C++26 reflection, we can simply iterate all data members of an object: #include <iostream> #include <meta> struct Foo { int x; int y; }; void PrintFoo(const Foo& foo) { ...
Timothy Liu's user avatar
10 votes
1 answer
494 views

The signature of std::thread::Scope::spawn looks like this: pub fn spawn<F, T>(&'scope self, f: F) -> ScopedJoinHandle<'scope, T> where F: FnOnce() -> T + Send + 'scope, ...
jacobsa's user avatar
  • 7,817
1 vote
6 answers
222 views

I've been studying Java for some time now to better understand what goes on inside some of the code parts. While studying Enum, which I am used to using exclusively for listing various fixed values (...
Ice K's user avatar
  • 37
3 votes
2 answers
232 views

I see many places in public repositories, where the first and last iterators of std::vector/std::string/std::string_view are converted into pointers using the combination of &* operators. In ...
Fedor's user avatar
  • 24.7k
5 votes
4 answers
253 views

I have a Windows Forms application and a Form with many async void event handlers. This form can be closed by the user at any moment. After closing the form I want to delete a temporary file, and my ...
Theodor Zoulias's user avatar
8 votes
1 answer
637 views

Does the code below contain undefined behavior (UB)? struct A { int x; char y; }; int main() { std::vector<uint8_t> v(sizeof(A), 0); A* p = reinterpret_cast<A*>(v.data());...
Dmitriano's user avatar
  • 2,424
10 votes
3 answers
1k views

I've always assumed that "creating an object" is the same thing as "starting its lifetime" (and not the same thing as allocating storage for it). But I've recently been told that &...
HolyBlackCat's user avatar
Advice
0 votes
6 replies
307 views

I'm looking for a way to store type "dynamicly" in a using (or concret implementation) that would be modifable and accessible at compile-time. I would like something like: struct ...
DipStax's user avatar
  • 572
Best practices
3 votes
12 replies
177 views

Here is the custom function to spell number to words using LAMBDA(). I would appreciate any improvement of the function or simplification if possible. Also suggest best practice for the function. =...
Harun24hr's user avatar
  • 38k
10 votes
1 answer
493 views

The order of bits in C11 bitfields is implementation-defined, and so is any padding in between them. This makes it difficult to access the bitfields by index at runtime, even though most ...
jpa's user avatar
  • 12.5k
2 votes
3 answers
173 views

I implemented std::hash<std::string> in the usual way, by specializing the std::hash template. But then I realized that these should already be provided by the <string> header (https://www....
luczzz's user avatar
  • 446
5 votes
6 answers
173 views

I have a list of items that contains duplicates, and I want to keep the last item of each group of duplicates. The native DistinctBy LINQ operator keeps the first item from each group, so it doesn't ...
Theodor Zoulias's user avatar
Best practices
0 votes
7 replies
153 views

My confusion is about the return statement inside readFileContents: The function returns std::optional<std::string>, but the local variable is a std::string. NRVO doesn’t apply here because ...
sam's user avatar
  • 911
Best practices
0 votes
11 replies
111 views

Edit: How does this recursive call play out, why is i = 1, even though the function fires 3 times ? Doesn't the function reach the if statement -> fires -> (this repeats 3 times) then reaches ...
RDU's user avatar
  • 1,121
Advice
0 votes
5 replies
179 views

To illustrate the ideas behind discriminant analysis, I created the image below containing a scatterplot with two groups and a plot of the densities of the scores, LD1 on the discriminant function. ...
user101089's user avatar
  • 4,083
-1 votes
3 answers
211 views

I am confused about the following behavior in C. #include <stdio.h> int main() { float a = 3.14; // literal is double float b = 3.14f; // literal is float printf("%f\n"...
Recent Job Circulars's user avatar
5 votes
2 answers
278 views

I have this code in C++: #include <iostream> #include <iomanip> #include <limits> #include <boost/multiprecision/mpfr.hpp> using namespace boost::multiprecision; template<...
Stasiu222's user avatar
5 votes
2 answers
180 views

In the released .NET 10 there is a new method added to the Volatile class with the name ReadBarrier(). And I don't know whether from the compilers perspective there is a difference if I do a read with ...
Dominik Ferencz's user avatar
Advice
2 votes
6 replies
83 views

I have an HTML page with some data that needs to be saved or discarded before certain other things can be done. I have several functions that will need to pause, wait for the user to make a decision, ...
Lee's user avatar
  • 420
4 votes
3 answers
141 views

I'm 100% new to Regex so I've been floundering about on regex101 trying to figure out how to get my desired output. I am using PostgreSQL to write a query to extract a set of values from the string. ...
snicksnackpaddywhack91's user avatar
5 votes
1 answer
157 views

The same code, one generated by macros and the other handwritten, produces different results.I'm lost and don't know how to fix it. my environment is follow: vs2019, msvc2019_64, c++14 if using ...
user31892351's user avatar
2 votes
2 answers
150 views

I am trying to use an MSP-EXP3430G2ET with a Buzzer and a potentiometer on CCS. The goal of the program is to have 2 modes, a high frequency mode and a low frequency mode. If you press the button, it ...
Sofia Happy Banya Ceregido's user avatar
7 votes
2 answers
181 views

I thought that during a permutation in an ObservableList, added and removed changes should not be generated. However, calling FXCollections.reverse() showed that this is not the case. This is my code: ...
SilverCube's user avatar
  • 1,138
9 votes
2 answers
233 views

I have two versions of helper methods for logging on ILogger. The first (classic extension methods) compiles fine; the second using extension members results in a compiler warning/error code. CS8620: ...
Christian's user avatar
  • 132
Advice
0 votes
7 replies
113 views

So I've been using this code for generating such statements following This Reddit post: #define LOOP(seq) END(A seq) #define BODY(x) int x; #define A(x) BODY(x) B #define B(x) BODY(x) A #define A_END #...
Doofus's user avatar
  • 3
3 votes
2 answers
132 views

typedef union { unsigned long anyvariable; float output; } map; return (*(map*)&fraction32).output; I copied this method of accessing the members of a union which ...
Cosmo Little's user avatar
0 votes
4 answers
113 views

I was attempting the binary tree inversion question on Leetcode https://leetcode.com/problems/invert-binary-tree/ I came up with this solution TreeNode* invertTree(TreeNode* root) { if (root ==...
Raghav Wadhwa's user avatar
Advice
1 vote
13 replies
104 views

I am trying to ensure that methods in my class can only be called by a single thread. So far tried to use ReaderWriterLockSlim to achieve this effect but this can cause potential issues if it is not ...
agracio's user avatar
  • 33
Advice
0 votes
13 replies
212 views

Java Tutorials site shows this example when discussing character streams: //The CopyLines example invokes BufferedReader.readLine and PrintWriter.println to do input and output one line at a time. ...
sebkaminski16's user avatar
-2 votes
2 answers
224 views

Consider this example: extern void black_box_foo(); extern void black_box_bar(); int main(){ black_box_foo(); // #1 black_box_bar(); // #2 } #1 and #2 are functions whose definitions are ...
xmh0511's user avatar
  • 7,618
2 votes
3 answers
166 views

I need to calculate hourly averages of wind directions using proper vector averages. Arithmetic averages result in the issue where averaging 350° and 10° gives 180° instead of 0°. The following is the ...
lightbluemobius's user avatar
Best practices
0 votes
3 replies
73 views

What I have: I have a dataframe with approx. 20,000 data records. In the first column are the names of employees ... in the second the value “participated” or “did not participate”. Each row ...
Isegrimm's user avatar
3 votes
1 answer
159 views

In the below code, I return a std::vector<A> from the get() function. If I make the std::vector<A> be a const type, the compilation fails, otherwise it passes. Can somebody explain this ...
Harry's user avatar
  • 4,132
Best practices
0 votes
8 replies
169 views

In the same spirit than the creation of an instance in a std::map when calling operator[] , I would like to emplace (direclty in the expression) in an std::optional only if has_value() is false. In ...
Caduchon's user avatar
  • 5,278
0 votes
1 answer
157 views

In my homework assignments I've got a task to get an input using scanf() of an integer number and check if its a positive negative or zero. I've coded this: #include <stdio.h> int main() { ...
CallMeEdwin's user avatar
Best practices
1 vote
4 replies
114 views

If my record implements an interface, with a field accessor implicitly implementing a method, it should be an instance of what the @Override annotation is meant to cover. interface I { int f(); } ...
ice1000's user avatar
  • 6,619
2 votes
2 answers
112 views

I recently started learning C and as a learning project I tried creating a tic tac toe bot using the Minimax algorithm. Here is the code that I have written so far: #include <stdbool.h> #include ...
floatingCatsAndDogs's user avatar
-1 votes
1 answer
210 views

I am currently studying the work of the mutex and I have a question, if we have the std::try_lock() method, then why not always use it instead of std::lock(), what are its disadvantages? For example, ...
freakl's user avatar
  • 7
1 vote
1 answer
126 views

My code should print the numbers given as command line arguments. Instead it prints random-looking values. What is going on and how can I fix it? #include <stdio.h> #include <pthread.h> #...
user31884282's user avatar
3 votes
2 answers
112 views

I'm working on this piece of code as part of my coursework, ideally any advice I get for this would be educational in some way; I don't want an exact answer, just need someone who knows more than I do ...
Eve's user avatar
  • 33
3 votes
2 answers
115 views

I am running python 3.13.5 via PowerShell in windows 10. I can successfully run the folowing command, and now want to run it with a python script & 'D:\realesrgan\realesrgan-ncnn-vulkan.exe' -i 'D:...
Christopher Pratt's user avatar
Advice
0 votes
8 replies
109 views

I’m building a file versioning system for my product ThinkNCollab, which includes both a Task Management System and an advanced File Versioning System. While designing the CLI for the versioning ...
TechieeRaman's user avatar
8 votes
1 answer
174 views

If I start two threads bound to CPU 0, where one is SCHED_IDLE, then why is it ever scheduled when the other thread is CPU bound at either normal priority, or at SCHED_FIFO? For SCHED_FIFO I get it, ...
Thomas's user avatar
  • 4,426
4 votes
2 answers
91 views

I have a Quarto doc rendering to HTML written in R and I would like a table without stripes. All of the kableExtra tables give me stripes. How do I get rid of the stripes? --- title: "Test" ...
Eric Krantz's user avatar
  • 2,339
3 votes
3 answers
129 views

I have a SQL table in postgres 14 that looks something like this: f_key data1 data2 fit 1 {'a1', 'a2'} null 3 1 {'b1', 'b2'} {'b3'} 2 2 {'c1', 'c2'} null 3 Note that data1 and data2 are arrays. I need ...
fitek's user avatar
  • 303
5 votes
1 answer
101 views

Both GCC and Clang reject extern "C" static void foo() {} but accept extern "C" { static void foo() {} } Aren't these supposed to be equivalent?
yuri kilochek's user avatar

15 30 50 per page
1
2 3 4 5
40