avatar
[转载] windows C++ -> Unix C++# Unix - 噫吁兮,危乎高哉
k*r
1
【 以下文字转载自 Programming 讨论区,原文如下 】
发信人: kreisler (little Kreisler), 信区: Programming
标 题: windows C++ -> Unix C++
发信站: Unknown Space - 未名空间 (Fri Jul 30 20:16:57 2004) WWW-POST
以前一直是做windows VC++,现在要转到 Unix C++,以前没有任何Unix的经验,请问有
什么书或者网上资源对我帮助最大的?多谢.
avatar
T*r
2
for non-GUI work, Advanced Programming in Unix Environment
for GUI work, Oreilly Xlib series, Qt/GTK

【在 k******r 的大作中提到】
: 【 以下文字转载自 Programming 讨论区,原文如下 】
: 发信人: kreisler (little Kreisler), 信区: Programming
: 标 题: windows C++ -> Unix C++
: 发信站: Unknown Space - 未名空间 (Fri Jul 30 20:16:57 2004) WWW-POST
: 以前一直是做windows VC++,现在要转到 Unix C++,以前没有任何Unix的经验,请问有
: 什么书或者网上资源对我帮助最大的?多谢.

avatar
k*r
3
Thanks for your response. May I ask does the book "Advanced Programming in
Unix Environment" mainly discuss Unix C++ programming?

问有

【在 T********r 的大作中提到】
: for non-GUI work, Advanced Programming in Unix Environment
: for GUI work, Oreilly Xlib series, Qt/GTK

avatar
T*r
4
C related. BTW, I don't see big difference between C and C++ on Unix.

【在 k******r 的大作中提到】
: Thanks for your response. May I ask does the book "Advanced Programming in
: Unix Environment" mainly discuss Unix C++ programming?
:
: 问有

avatar
k*r
5
I see. But is there any concerns with OOD under Unix? In other words, might
experiences in OOD under windows shift to Unix environment safely.

【在 T********r 的大作中提到】
: C related. BTW, I don't see big difference between C and C++ on Unix.
avatar
T*r
6
OOD is different from OO language. Using assembly lang you can also do OOD.
In Unix, stuff like file descriptor, X Window resource handles are all OOD.

【在 k******r 的大作中提到】
: I see. But is there any concerns with OOD under Unix? In other words, might
: experiences in OOD under windows shift to Unix environment safely.

avatar
k*r
7
In order to implement OOD, there should be some constructs and features to
support OOD. Also compiler must understand these constructs and features.
Based on that, I don't think by using assembly, you can do OOD.

might

【在 T********r 的大作中提到】
: OOD is different from OO language. Using assembly lang you can also do OOD.
: In Unix, stuff like file descriptor, X Window resource handles are all OOD.

avatar
T*r
8
you are talking about OOP, not OOD

【在 k******r 的大作中提到】
: In order to implement OOD, there should be some constructs and features to
: support OOD. Also compiler must understand these constructs and features.
: Based on that, I don't think by using assembly, you can do OOD.
:
: might

avatar
k*r
9
Could you tell me how assembly implements OOD? I am just curious.

OOD.
OOD.

【在 T********r 的大作中提到】
: you are talking about OOP, not OOD
avatar
T*r
10
I said use assembly lang you can do OOD, I didn't say use assembly lang
to implement OOD. OOD is not a programming (implementation) issue, it's
a design issue. Different languages have different features that may
make implementation easier or more difficult.

【在 k******r 的大作中提到】
: Could you tell me how assembly implements OOD? I am just curious.
:
: OOD.
: OOD.

avatar
k*r
11
Okey. My question would be that how assembly does OOD? Personally I didn't
understand what "assembly does OOD" means in the first place. So that is why I
didn't state my question the way you prefer. Sorry about that.

【在 T********r 的大作中提到】
: I said use assembly lang you can do OOD, I didn't say use assembly lang
: to implement OOD. OOD is not a programming (implementation) issue, it's
: a design issue. Different languages have different features that may
: make implementation easier or more difficult.

avatar
p*f
12

(1) Linux Kernel is a good exmaple of OOD in C, for example, check out
the VFS module. It has encapsulation, inheritance, and polymorphism.
It is mainly implemented with function pointers.
(2) ASM has all the major features of C, including function, struct,
pointers, function pointers etc. So, it's not impossible to do OOD
with ASM.

【在 k******r 的大作中提到】
: Okey. My question would be that how assembly does OOD? Personally I didn't
: understand what "assembly does OOD" means in the first place. So that is why I
: didn't state my question the way you prefer. Sorry about that.

avatar
k*r
13
Very interesting. Let's get into the details a little bit. Say in C, I define
a struct as:
typedef struct myStruct
{
int i;
} tagStruct;
// we can access i
int main()
{
tagStruct tagStru;
tagStru.i = 1;
return 1;
}
I wander how you can implement a PRIVATE access modifier in C. In my example,
how could you make i as private so that when I try to access it within
function main, the compiler will complain?

why I

【在 p******f 的大作中提到】
:
: (1) Linux Kernel is a good exmaple of OOD in C, for example, check out
: the VFS module. It has encapsulation, inheritance, and polymorphism.
: It is mainly implemented with function pointers.
: (2) ASM has all the major features of C, including function, struct,
: pointers, function pointers etc. So, it's not impossible to do OOD
: with ASM.

avatar
p*f
14

C is not an OOPL, but you may try something like this:
/* tag.h */
struct tag;
int tag_get_i(const struct tag* ptag);
void tag_set_i(struct tag* patg, int i);
#include "tagimp.h"
/* end of tag.h */
/* tagimp.h */
struct tag { int m_i; };
/* end of tagimp.h */
/* main.c */
#include "tag.h"
int main() {
struct tag t;
tag_set_i(&t, 1);
tag_get_i(&t);
}
Implementation of tag.c is ignored, but that's trivial. As tag class user,
you only see tag.h, and link with tag.c, so, information is prope

【在 k******r 的大作中提到】
: Very interesting. Let's get into the details a little bit. Say in C, I define
: a struct as:
: typedef struct myStruct
: {
: int i;
: } tagStruct;
: // we can access i
: int main()
: {
: tagStruct tagStru;

avatar
T*r
15
actually I love this better than C++ since the details of struct tag can
be completely hidden from the user who uses it: just think about how UNIX
implement the file descriptor and file operations...
for C++, you probably still exports the structure of an object in the
header file, though some members may be marked as 'private' - in another
word, I can still see the internal details!!! This is why I like the OOD
in UNIX files, Xlib and Win32 API - you should try to understand the
idea behind the

【在 p******f 的大作中提到】
:
: C is not an OOPL, but you may try something like this:
: /* tag.h */
: struct tag;
: int tag_get_i(const struct tag* ptag);
: void tag_set_i(struct tag* patg, int i);
: #include "tagimp.h"
: /* end of tag.h */
: /* tagimp.h */
: struct tag { int m_i; };

avatar
m*m
16
每个unix(solaris, hp ... ) 都会提拱programming guide之类的文件, 可以看看



【在 k******r 的大作中提到】
: 【 以下文字转载自 Programming 讨论区,原文如下 】
: 发信人: kreisler (little Kreisler), 信区: Programming
: 标 题: windows C++ -> Unix C++
: 发信站: Unknown Space - 未名空间 (Fri Jul 30 20:16:57 2004) WWW-POST
: 以前一直是做windows VC++,现在要转到 Unix C++,以前没有任何Unix的经验,请问有
: 什么书或者网上资源对我帮助最大的?多谢.

avatar
k*r
17
I don't think your example makes any sense, no offence. Actually, the
separation of cpp files from header files has nothing to do with
encapsulation.

example,

【在 p******f 的大作中提到】
:
: C is not an OOPL, but you may try something like this:
: /* tag.h */
: struct tag;
: int tag_get_i(const struct tag* ptag);
: void tag_set_i(struct tag* patg, int i);
: #include "tagimp.h"
: /* end of tag.h */
: /* tagimp.h */
: struct tag { int m_i; };

avatar
T*r
18
my favorite:
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。