Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
Score of 5
2 answers
217 views

The C99 standard draft n1256 says the following about restrict qualified pointers in 6.7.3.1p3, 6.7.3.1p4 3 In what follows, a pointer expression E is said to be based on object P if (at some ...
Score of 0
0 answers
102 views

I have a class which stores a const pointer to some external data. To get the pointer, the user passes in an object by reference. The object should be permitted to be const. As well as the class I ...
Score of -4
4 answers
147 views

In this python I expect either for x to be assigned to 1, OR for an error/exception to be raised. Instead, nothing happens. The statement is not an error but it also has no effect. x = 0 [x][0] = 1 ...
Score of 3
3 answers
211 views

This question arouse from the question "why is const in function return type, which is a const pointer, ignored?" (const pointer, not pointer to const) int* const Foo(); is identical to int*...
Score of 5
2 answers
329 views

In C++, a function with signature void f(A& a) (non-template) only binds to a lvalue. Is it possible for an rvalue to automatically cast itself to an lvalue? This is what I tried: #include <...
Score of 13
5 answers
2037 views

I’m working on understanding pointers in C by breaking down the language into three key areas: syntax, semantics, and idioms. To grasp pointers, I’ve been focusing on fundamental concepts: what’s an ...
Score of 4
1 answer
88 views

Ok this might be a bit difficult to explain: I want to call a function hello that has an overload for either an rvalue or an lvalue ref of type Json. This Json object is converted from a JsonKey using ...
Score of 4
1 answer
119 views

In C++, a named rvalue reference is lvalue. Why the below code yields "error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'"? int & unmove(int &...
Score of 1
2 answers
177 views

I was reading C Notes for Professionals, in which, it claims that Compound Literals can only be lvalues. But LLMs have mixed answers upon that stating it could depend upon the context and could be ...
Score of 2
1 answer
112 views

I was doing Leetcode when I stumbled upon this interesting technique. Here it is in short: #include <iostream> #include <vector> void print(std::vector<int>& vec) { for (int ...
Score of 27
3 answers
5466 views

Some time ago I stumbled upon the idea of how a C construct, such as (expr0, expr1, expr2), evaluates (see "What does the comma operator , do?" for more context). I've started experimenting ...
Score of 1
1 answer
278 views

Hi I have a quick question - over here it says ranged-based for loops of the form for ( init-statement (optional) range-declaration : range-expression ) are equivalent to the code: { auto &&...
Score of 1
2 answers
92 views

#include <stdio.h> #include <stdlib.h> typedef struct { int *array; int size; }Array; Array array_create(int init_size); int* array_at(Array *,int index); void ...
Score of 2
1 answer
81 views

I'm having trouble using a Perl subroutine reference as an lvalue. Am I doing something wrong here, or is it not possible to do this? I'm using ActiveState Perl 5.20 on Windows. package Warning { ...
Score of -2
2 answers
1266 views

I had a queue and originally worked with strings and now I added templates to it so that if I decide to add int doubles, etc, it would still work. When using strings to add to my queue, I get an error ...

15 30 50 per page
1
2 3 4 5
46