什么是印刷将为pid_t正确的printf的说明 [英] What is the correct printf specifier for printing pid_t

查看:316
本文介绍了什么是印刷将为pid_t正确的printf的说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用一个显式类型转换为长而使用%LD 打印将为pid_t ,有没有符如%Z 为size_t 将为pid_t <? / p>

如果不是印刷的最佳方式将为pid_t


解决方案

有没有这样的说明。我想,你在做什么是好的...你可以使用更广泛的int类型,但没有实现,其中pid_t则为比长更大,也许永远不会。

I'm currently using a explicit cast to long and using %ld for printing pid_t, is there a specifier such as %z for size_t for pid_t?

If not what the best way of printing pid_t?

解决方案

There's no such specifier. I think what you're doing is fine ... you could use an even wider int type, but there's no implementation where pid_t is bigger than long and probably never will be.

这篇关于什么是印刷将为pid_t正确的printf的说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆