Most active questions
3,152 questions from the last 30 days
Advice
18
votes
19
replies
4k
views
Apparently my code is AI-generated (except it's not)
I was curious, and I decided to run my code through some detect AI code. I was getting results of 90-99% AI generated code... Except I wrote every line myself.
I was getting comments such as: "...
Best practices
8
votes
20
replies
590
views
Best practices in writing Java and the right way in learning it
I’m a computer science student who just picked up Java. What are the best practices in writing Java in 2026? Also, what are the right way in learning it? It’s a programming language that I am really ...
36
votes
2
answers
2k
views
Is there any construct valid since C++98 that behaves differently between C++20 and C++23?
Just for fun, I'm trying to write a program that detects C++ version based purely on syntactic quirks between standards. I've managed to piece together solutions for all but the newest standard.
#...
6
votes
1
answer
4k
views
Xcode 26.4 build error: "call to consteval function 'fmt::basic_format_string' is not a constant expression" in React Native iOS build
I am encountering a build error while compiling a React Native iOS project using Xcode 26.4.
Environment
React Native: 0.81.x
Xcode: 26.4
macOS: 26.4
Error
During the build process, I get the ...
22
votes
1
answer
1k
views
I covered all subclasses of a sealed class in a switch expression, but the Java compiler still claims the switch is not exhaustive. Why?
Assume the structure:
sealed class Shape permits Circle, Quadrangle {}
sealed class Quadrangle extends Shape permits Diamond, Rectangle { }
final class Rectangle extends Quadrangle {}
final class ...
Advice
0
votes
23
replies
521
views
Is this possible? A new AI-age language, as easy as Python, as fast as C++, more secure than Rust
With the AI being so powerful, we should have a better programming language. This language is named cpluz/cz, signifying that it is generally between C and C++, but with some differences. Because its ...
14
votes
3
answers
971
views
Is passing NULL valid when array parameter uses [static 0] in C99?
Consider the following code:
void foo(size_t len, int array[static len])
{
}
int main(int argc, char *argv[])
{
foo(0, NULL);
return 0;
}
The function foo declares its second parameter using ...
Advice
1
vote
17
replies
462
views
Why are the variables in main() are on the stack in C?
Why do compilers put the variables of the main() function onto the stack instead of the ".data" area?
It must have the same result, because it's invalid to call the main() function.
int ...
18
votes
2
answers
1k
views
Where in the C standard does it specify the corresponding argument for %n in fscanf shall be a pointer to int
The C23 standard draft n3220 says the following about the conversion specifier n for fscanf in statement 7.23.6.2p12 (emphasis mine)
n No input is consumed. The corresponding argument shall be a ...
23
votes
1
answer
919
views
Dealing with overflow in chrono
It is well known that it is easy for <chrono> to silently overflow under the hood when pushing the boundaries of its range.
For example:
using namespace std::chrono;
years y{300};
nanoseconds x{...
6
votes
6
answers
720
views
Convert string in ISO 8601 format to datetime
I have character data in an ISO 8601 format that I would like to convert to a datetime variable. I tried the following:
library(lubridate)
datetime_str <- "2026-04-02T02:16-04:00"
dt &...
6
votes
5
answers
658
views
Converting a data set into a data frame
I have this data set
df<-
structure(list(x = list(structure(c(1.2956002895122, 0.84856971403248,
0.318587376385379, 1.52311609250527, 0.761866777256873, 1.34942921531382,
1.32182157459345, 0....
Best practices
1
vote
28
replies
316
views
What can be considered as a best practice for manipulating values inside a vector in C++
Suppose I have to manipulate the values inside a vector defined in C++ and the manipulation operation is to obtain the square of each value inside the vector
#include<vector>
#include<...
13
votes
3
answers
951
views
Is strtol(str, &str, 10) legal in C99 due to restrict aliasing?
Consider the following code:
char *str = "1234";
long n = strtol(str, &str, 10);
The prototype of strtol() in C99 is:
long strtol(const char *restrict nptr, char **restrict endptr, int ...
Best practices
2
votes
20
replies
355
views
Get a value of non-default-constructible type `T` from a byte array without undefined behavior
I'm messing with FFI between Rust and C++ and I happen to know that some particular array of bytes pointed by a std::byte * pointer is a valid C++ object of type T, which can be anything for what ...