New answers tagged c
0
votes
What is the difference between a pointer pointing to 0x0 location and a pointer set to NULL?
To illustrate the point in the other answers, years ago I wrote some C code to run on Inmos Transputers. They were strange things in several ways. One way was that memory addresses were signed ...
0
votes
Why is int in C in practice at least a 32 bit type today, despite it being developed on/for the PDP-11, a 16 bit machine?
Int wasn’t 16 bit to support PDP/11 but to support a machine popular at the time. Today, we support machines that are popular today. You can get ARM-Cortex 64 bit processors for very little money. So ...
0
votes
Why is int in C in practice at least a 32 bit type today, despite it being developed on/for the PDP-11, a 16 bit machine?
C was designed to be maximally portable, and while 8-bit bytes / 16-bit words / 32-bit longwords are common, they aren't universal. There are real-world architectures that use 9-bit bytes and 36-bit ...
0
votes
What is the purpose of NaN boxing?
You always run the risk that the extra bits in a NaN are not preserved, depending on the implementation. (What must be preserved is the silent/signalling bit, and the fact that some but is set). It’s ...
5
votes
Accepted
Maintaining global states in a recursive function
Using global data is bad because your recursive function cannot be used from multiple threads. Which is a horrible trap, because 99.99% of the time it’s not called from multiple threads at the same ...
7
votes
Maintaining global states in a recursive function
Global and in scope are different things. Either a closure or an object will give you a place to declare fields that are accessible from call to call, maintain state, and are not global.
In closures ...
Top 50 recent answers are included
Related Tags
c × 1310c++ × 285
programming-languages × 75
design × 62
compiler × 61
pointers × 54
coding-style × 53
java × 52
embedded-systems × 47
memory × 46
data-structures × 45
linux × 40
multithreading × 39
programming-practices × 36
object-oriented × 35
python × 33
assembly × 33
algorithms × 30
libraries × 28
performance × 27
api-design × 25
architecture × 24
design-patterns × 23
history × 23
array × 23