5 ms·
> can the behaviour of the following bit of C code depend > on a modern computer, a pointer dereference could very lead to the execution of Python code. So th
by bumholio 8y ago
> can the behaviour of the following bit of C code depend
> on a modern computer, a pointer dereference could very lead to the execution of Python code.
So the BEHAVIOR of the C code does not change. The dereference of the pointer triggers a memory page load, and if that load is successful, a numeric value is returned and added to the array. If the load fails, you will have the undefined result of accessing uninitialized memory.
In both cases, the behaviour of the code remains squarely within the C standard - with the actual result of the computation contingent on various external factors.
- vokep 8y agoThe behavior isn't changed, right, but it depends on python behavior. IF the python behavior changed somehow, than the C behavior might as well, and due to the A implies B & B implies A basic structure of the system, very weird unpredictable behavior might result.
- bumholio 8y agoBut the behavior of any data dependent algorithm depends on any behavior change in the upstream data source. If you pipe Seti@home data into the array, the behavior of the program might depend on what some distant alien intelligence did thousands of light-travel-years ago. Is it "weird unpredictable" or is it exactly what you programmed into it?