C是面向对象的语言......? [英] Is C a Object oriented language...?

查看:93
本文介绍了C是面向对象的语言......?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C基本上是一种非面向对象的语言,然后在UNIX中进行系统编程时为什么我们有两个不同版本的OPEN函数(系统调用):

C is basically a non-object oriented language, then while doing system programming in UNIX why we have two different versions of OPEN function (system call):

展开 | 选择 | Wrap | 行号

推荐答案

很多人都说C是C ++的一个子集。有人说C ++是C的一个子集。看起来UNIX系统在重载open()函数时可以安全地播放它。
Many people say that C is a subset of C++. Some say that C++ is a subset of C. It would seem that UNIX system is playing it safe in overloading the open() function.


@whodgson


我不确定我是否听过有人说过第二个。 C和C ++最像是拥有相同父级的兄弟姐妹。 C ++支持很多但不是所有的C标准,C绝对不支持所有C ++标准。


发布的代码片段不是C,不会用C编译.C不支持函数重载并产生这些诊断。


2:错误:''打开'的冲突类型'

1:注意:之前的声明''open''在这里


另外没有给出路径名的类型。
@whodgson
I''m not sure that I have heard anyone say the second. C and C++ are most like siblings with the same parent. C++ supports a lot but not all of the C standard, C definitely doesn''t support all of the C++ standard.

The posted code snippet is not C and will not compile with C. C does not support function overloading and produces these diagnostics

2: error: conflicting types for ''open''
1: note: previous declaration of ''open'' was here

Additionally no type is given for pathname.


@Banfa


到BENFA,


thanx用于你的回复,但该代码不是任何可执行文件的一部分,它只是open()函数在unix中的原型。 。并且可以根据要求使用任何一个功能,也没有任何错误。


实际上我问的是为什么有两种不同的open()函数即使我们在UNIX下用C语言进行系统编程。
@Banfa
TO BENFA,

thanx for your reply, but that code is not a part of any executable, it is just the way open() function has been prototyped in unix. and one can use any one of the function as per the requirment, that too without any error.

actually what i was asking is that why there are two diffrent flavours of open() function, even when we doing system programming in UNIX under C language.


这篇关于C是面向对象的语言......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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