_itoa和itoa有什么区别? [英] What is the difference between _itoa and itoa?

查看:816
本文介绍了_itoa和itoa有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio正在喊我使用itoa()...说使用_itoa?它看起来像我一样的功能...什么给了?

Visual Studio is yelling at me about using itoa()... saying to use _itoa instead? It looks to me like they are the same function... what gives?

推荐答案

AC运行时库实现不应该引入不在标准中的名称,除非它们遵循特定的命名约定(例如以下划线开头)。早期版本的Microsoft编译器没有特别密切地遵循这个规则,但随着时间的推移,Microsoft已经越来越多地使它们的实现更符合标准。因此,它们用来提供的函数会侵入用户的命名空间,他们使用为编译器实现保留的名称来实现它们,并且一直在废弃旧的名称。

A C run time library implementation is not supposed to introduce names that aren't in the standard unless they follow a certain naming convention (like starting with an underscore). The earlier versions of Microsoft's compiler didn't follow this rule particularly closely, but over time, Microsoft has been moving more toward making their implementation more standards compliant. So functions they used to supply that would intrude on the user's namespace they have been implementing using names that are reserved for compiler implementations and have been deprecating the old names.

如果 _CRT_NONSTDC_NO_WARNINGS ,MS编译器不会抱怨 itoa()函数已被弃用。但它仍然会抱怨它是不安全的(你必须定义 _CRT_SECURE_NO_WARNINGS 才能安静该警告)。或使用函数( _itoa_s())提供目标缓冲区大小的更安全版本

If _CRT_NONSTDC_NO_WARNINGS is defined, the MS compiler won't complain about the itoa() function being deprecated. But it will still complain about it being unsafe (you have to define _CRT_SECURE_NO_WARNINGS to quiet that warning). Or use the safer version of the function (_itoa_s()) that provides the function with the destination buffer size

_itoa() itoa()解析到库中完全相同的函数,除了名字之外没有区别。

Both _itoa() and itoa() resolve to the exact same function in the library down to the same address - there is no difference except in the name.

这篇关于_itoa和itoa有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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