Comments (3)
这只是一种风格,kernel 就是全暴露的,对于结构体,全暴露的好处是,外面可以静态声明,无需分配,你如果隐藏定义,就只能每次分配了。全暴露另外一层用以是,保留其他模块可以任意扩充的可能,C 模块更多是底层工具,我希望保留这种能力。
from asyncnet.
谢谢韦老师的建议。
我放心了,因为您说的上述优先, libevent2 的写法是可以拥有的,只是要稍微麻烦点,要把 abc.h 拆分成 abc-internal.h 和 include/abc.h , 但是我希望让用户看到 .h 超级少的函数声明 + 注释用法。
感谢指点。
from asyncnet.
您是对的,我现在也认为暴露出来要好。
我昨晚看了 libev 的代码,发现 ev.h 是暴露出来的,但是其没有实现 buffer, 但是我可以方便地扩展。
但如果我要在 libevent 重新实现自己的 bufferevent 是困难的,因为编译后的 include/ 并没有暴露出 event(其实有暴露,但是官方说是为了兼容,实际不鼓励用) 。还是要用到开发者内部的 xxoo-internal.h, 还不如一开始就给用户暴露出来, 让用户可以扩展.
from asyncnet.
Related Issues (3)
- itimer.c & itimer.h HOT 7
- win10 编译报错 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asyncnet.