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

Pointers to userspace on x86_64 must start with 0x000, covering 12 of the 64 bits and leaving 48 for the actual pointer. Will a userspace program ever get a kernelspace pointer, or is it safe to ...
Advice
1 vote
15 replies
322 views

I am trying to understand whether the following C++ program has well-defined behavior. #include <bits/stdc++.h> using namespace std; int main() { int a = 15, b = 10; int *p = &a, *...
Score of 3
2 answers
231 views

Consider this, { char* p = malloc(1); strcpy(p, "Hello World!"); printf("%s", p); } This would print Hello World! . But how, I expected this to fail, but it seems ...
Best practices
0 votes
19 replies
274 views

There is a piece of code, which definitely has UB: free(s); logsimple("fs body %p freed (g_free_body_cnt %d)", s, ++g_free_body_cnt); logsimple() is just a macro-wrapper over fprintf(...
Score of 0
3 answers
210 views

Suppose I have a function which takes a pointer, either for reading from or for writing, e.g.: int foo(int const* x) { return *x; } Now, if x is an address into a readable part of memory - then this ...
Advice
2 votes
8 replies
220 views

There is a significant difference between a reference and a pointer. But I want to ask at the low level how are they different. Some people say that references are just pointers under the hood but and ...
Advice
0 votes
26 replies
307 views

I am new to programming and learning about pointers in C , although it's easy but I want to know how pointers are implemented internally within systems because I want to be a system software so I am ...
Score of 0
2 answers
332 views

I'm trying to understand why a reference to a pointer behaves differently from a reference to a non-pointer. The following program fails to compile with Clang: int main() { int i = 42; int *...
Score of 0
1 answer
206 views

The definition of pointer-interconvertible (https://eel.is/c++draft/basic.compound#6) states that: If two objects are pointer-interconvertible, then they have the same address, and it is possible to ...
Best practices
2 votes
4 replies
149 views

Note I'm practicing asm after reading a book, sample code below is a skeleton function to read a file (it's incomplete and for practice only). I'm allocating a 64-bit pointer file_buffer resq 1 in ...
Score of 1
1 answer
195 views

UPDATE: See the answer I added, for a "somewhat acceptable" solution For a 2-dimensional array, the expression transpose(x) is not acceptable in "variable context" so you can't ...
Score of 1
1 answer
142 views

[intro.object] seems to say that implicit object creation, at least for operations that return a pointer, occurs at the returned location (https://eel.is/c++draft/intro.object#14 and https://eel.is/c++...
Advice
1 vote
7 replies
140 views

I have been studying C++ for a bit of time now. I am still a novice, but I continue to learn daily and practice and pickup new things. One thing I haven't been seeing too much information on is ...
Advice
1 vote
1 replies
92 views

My question might just be that I don't understand something in the Python API, but I have the following code for a node in a Linked List: typedef struct Node { PyObject* data; struct Node* ...
Score of 1
2 answers
211 views

Recently, for a small little project, I needed to write a barebones replacement for pwd.h, however, in implementing one function, something isn't working quite right. The code for win_pwd.h is: #...

15 30 50 per page
1
2 3 4 5
3818