intmain(){ fun(0); // Run-time error: basic_string::_M_construct null not valid }
其中,fun(0)的0会被视为const char*类型,也就是nullptr,所以在编译期可以通过。
但是运行期会触发string对象的构造错误“basic_string::_M_construct null not valid”。
隐蔽一点的代码:
1 2 3 4 5 6 7 8 9 10 11
char * get_a_string(){ returnnullptr; }
intmain(){ // Attention: Alaways take care that a parameter to a string should not be NULL! fun(get_a_string()); // Run-time error: basic_string::_M_construct null not valid // Better code char * str = get_a_string(); fun(str != NULL? str : ""); }
挂载点:A mount point is a location in the partition used as a root filesystem.
驱动
相关命令一览表
lsblk
lsblk [options] [device...]
list all avaivable or specified block devices.
Reads the sysfs filesystem to gather information.
df
df [OPTION]... [FILE]...
report file system disk space usage on which each FILE resides.
df -T 打印文件系统的类型。
du
du [OPTION]... [FILE]...
estimate file space usage.
quota
quota -s -u user...
display users' disk usage and limits.
quota reports the quotas of all the filesystems listed in /etc/mtab.
For filesystems that are NFS-mounted a call to the rpc.rquotad on the server machine is performed to get the information.
-s, --human-readable
repquota
prints a summary of disc usage and quotas for the specified file system.
#pragma weak means that even if the definition of the symbol is not found, no error will be reported.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include<stdio.h>
// It is not an error for symbol to never be defined at all. // Without this line, the address of "foo" will always evaluate to "true", // so the linker will report an "undefined reference to 'foo'" error. #pragma weak foo // The declaration is needed. /* extern */voidfoo();