k******r 发帖数: 2300 | 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的经验,请问有
什么书或者网上资源对我帮助最大的?多谢. | T********r 发帖数: 6210 | 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的经验,请问有 : 什么书或者网上资源对我帮助最大的?多谢.
| k******r 发帖数: 2300 | 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
| T********r 发帖数: 6210 | 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? : : 问有
| k******r 发帖数: 2300 | 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.
| T********r 发帖数: 6210 | 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.
| k******r 发帖数: 2300 | 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.
| T********r 发帖数: 6210 | 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
| k******r 发帖数: 2300 | 9 Could you tell me how assembly implements OOD? I am just curious.
OOD.
OOD.
【在 T********r 的大作中提到】 : you are talking about OOP, not OOD
| T********r 发帖数: 6210 | 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.
| | | k******r 发帖数: 2300 | 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.
| p******f 发帖数: 162 | 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.
| k******r 发帖数: 2300 | 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.
| p******f 发帖数: 162 | 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;
| T********r 发帖数: 6210 | 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; };
| m*m 发帖数: 47 | 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的经验,请问有 : 什么书或者网上资源对我帮助最大的?多谢.
| k******r 发帖数: 2300 | 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; };
| T********r 发帖数: 6210 | |
|