兼容类型和参数类型修饰符 [英] Compatible types and argument type qualifiers

查看:115
本文介绍了兼容类型和参数类型修饰符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是类型这两个声明的兼容的类型?

Are the types of these two declarations compatible types?

void f(char *, char *);
void f(char *restrict, char *restrict);

或类似

void g(char *);
void g(char *const);

我有一个很难找到的覆盖问题,标准的东西。我它是否是有效的手工原型的函数的话题最感兴趣的,省略限制关键字,在实际的类型可能有限制合格取决于C或使用其他库版本的版本参数。

I'm having a hard time finding anything in the standard which covers the issue. I'm mostly interested in the topic of whether it's valid to manually prototype a function, omitting the restrict keyword, where the actual type might have restrict-qualified arguments depending on the version of C or version of other libraries in use.

推荐答案

C11部分6.7.6.3§15:

C11 section 6.7.6.3 §15:

在类型兼容性和复合型的决心,每个参数与功能或数组类型声明被视为具有调整的类型和与限定的类型声明的每个参数作为具有其宣称的无保留意见的版本类型

In the determination of type compatibility and of a composite type, each parameter declared with function or array type is taken as having the adjusted type and each parameter declared with qualified type is taken as having the unqualified version of its declared type.

这篇关于兼容类型和参数类型修饰符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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