Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我只是通过perlxstut,我newSVnv在示例 5和示例 6中找到了,但我认为这newSVuv应该更合适。奇怪的是newSVnv也有效。这是怎么回事?
newSVnv
newSVuv
我认为它使用 NVs(Perl 相当于 a C double)而不是 UVs (通常是 a unsigned int),因为(取决于操作系统和编译选项), a 中的一些值struct statfs可能是 64 位,即使 Perl 使用 32 位整数. newSVnv因为 C 编译器知道如何将任何整数类型转换为double.
double
unsigned int
struct statfs
您应该能够替换newSVnv任何newSVuv适合statfsUV 的成员,并让它正常工作。Perl 会根据需要自动在其数字类型之间进行转换。
statfs