Jan 21, 2007 How to specify a nonnull pointer argument in C. C C Forums on Bytes. 423, 284 Members 1, 439 Online Join Now; Passing a null pointer to fn() invokes undefined behavior; there is no required or implied check. The compiler would automatically test for NULL before pushing the Nov 14, 2008 The caller is allowed to pass a null pointer, and is guaranteed a specific type of exception.
I'd consider this case fairly rare, but there are probably cases I know that NULL is# defined to be 0. This is not something that's guaranteed by the standard. NULL may be any valid null pointer literal, which includes 0, 0L and nullptr. Feb 05, 2015 You would have to pass the pointer by reference in order to retrieve the address of funcValue2 from the function.
Doing this could cause the trouble you're asking about. This would require passing arguments differently, destroying the" optional retrieval" method that you want. 3 The macro NULL is an C null pointer constant in this International Standard (4. 10). 4. 10 Pointer conversions [conv. ptr 1 A null pointer constant is an integer literal ( ) with value zero or a prvalue of type std: : nullptrt.
The trouble is that NULL is a bit ambiguous. While it is semantically a pointer, it can (and in your implementation is) of integral type. 18. 2 Types [support. types 3 The macro NULL is an C null pointer constant in this International Standard (4. 10). 4. 10 Pointer conversions [conv.
ptr 1 A Mar 06, 2017 I think setting a deleted pointer to null is a very bad idea. The purpose of this maneuver is to make it possible to execute delete on the same pointer twice (deleting a null pointer has no effect), which means the program has no clue what has or hasn't been allocated. That needs to be fixed, not enabled by nulling out pointers. Bug warning about pass NULL to non pointer argument happens twice Summary: warning about pass NULL to non pointer argument happens twice Status: