Explore chapters and articles related to this topic
Introduction
Published in Randall L. Eubank, Ana Kupresanin, Statistical Computing in C++ and R, 2011
Randall L. Eubank, Ana Kupresanin
Null pointers are actually quite useful. Although they cannot be dereferenced, they can be compared using == and != to other pointers. No other valid pointer (i.e., one that points to a valid location in memory) will compare as equal to the null pointer and this can be used in conditional statements to determine if a memory allocation problem has occurred, if a function has executed successfully, etc. Null pointers play an essential role in many of the basic operations that are performed with the abstract data structures of Chapter 9.
Security and Dependability Aspects
Published in Ivan Cibrario Bertolotti, Tingting Hu, Embedded Software Development, 2017
Ivan Cibrario Bertolotti, Tingting Hu
A null pointer is a pointer that has a special reserved value, corresponding to the macro NULL in the C language. This reserved value indicates that the pointer does not point to any object in memory, and hence, it cannot be dereferenced.
False positive elimination in suspected code fault automatic confirmation
Published in International Journal of Computers and Applications, 2018
Honglei Zhu, Dahai Jin, Yunzhan Gong
The code in Figure 1 is a program segment of spell_1.0 which is an open source program. A null pointer dereference (NPD) fault is detected at the statement S4 using static defect detection tool DTS to analyze spell_1.0, and statement S4 is marked as an inspection point, the pointer q denotes as the defect feature. We confirm the inspection point at S4 by manual, and find that whether the pointer q is null value mainly depends on the return value of procedure xmalloc(). Then analyzing the procedure xmalloc() in detail, when the pointer p is null, it will execute statement S12 which contains the callee error() that will exit the program execution. On the contrary, when pointer p is not null, the return value of xmalloc() is not null. Therefore, the inspection point at statement S4 is a false positive. The main causes of false positive generation is that, in order to improve the speed of program analysis, the static analysis tools usually use the procedure summary of each callee to replace the detailed path-sensitive analysis of the callee at the call site during the static analysis. Obviously, it will lost the precision of analysis and generate false positives.
Block-structured compressible Navier–Stokes solution using the OPS high-level abstraction
Published in International Journal of Computational Fluid Dynamics, 2016
Satya P. Jammy, Gihan R. Mudalige, Istvan Z. Reguly, Neil D. Sandham, Mike Giles
To declare data on the blocks, the OPS API (ops_decl_dat) is shown in lines 7 − 10 of Figure 1. Data set declaration in OPS requires information about the block on which it should be declared, the number of dimensions (ndim), the size of the array (size), the number halo points in the positive and negative direction (d_p, d_m), data (dat), as well as its data type and the name (used for debugging). If a NULL pointer is provided as the data, OPS automatically allocates the required amount of memory, depending on the shape of the array and the data-type provided.
COTS software integration for simulation optimization coupling: case of ARENA and CPLEX products
Published in International Journal of Modelling and Simulation, 2019
Valeria Borodin, Jean Bourtembourg, Faicel Hnaien, Nacima Labadie
Moreover, note that a NULL pointer can be passed as argument in one of the CPLEX routines by ByVal 0&. General requirements about the interface between Visual Basic, C/C++, and Windows API can be found for example in the book of Ref. [39].