pxkw.hatenadiary.com

めもめも

fprintfとかのstreamにNULLを渡した時の挙動は未定義

C Language, Using fprintf() with a NULL-stream

Section 4.1.6 Use of Library Functions
Each of the following statements applies unless explicitly stated otherwise
in the detailed descriptions that follows. If an argument to a function has
an invalid value (such as a value outside the domain of the function, or a
pointer outside the address space of the program, or a null pointer), the
behavior is undefined.
4.9.6.1 The fprintf Function {says nothing about a NULL stream}
4.9.6.5 The sprintf Function {says nothing about a NULL buffer pointer}
Ergo, in both cases, the behavior is undefined.


書いてないものは動作を規定しないってスタンスか。