生产代码中的面向方面 C(不是 C++)

发布于 2024-11-07 03:01:22 字数 584 浏览 2 评论 0原文

这是从上一个问题进一步衍生出来的问题: https://stackoverflow.com/questions/1834485/aspect-oriented-programming-aop-in-c-not-c-anyone-doing-it

这个问题的答案向我们指出了一些研究实践:皇后大学在这里: http://sailhome.cs.queensu.ca/~bram/aspicere/索引.html

除了这些研究工作之外,还有人知道在生产代码中面向方面的 C 的实际用法吗?如果不是,您认为困难在哪里?如果是的话,是什么障碍让它不受欢迎呢?

我认为AOP的好处是显而易见的。但在AOP-Java流行了十年之后,AOP-C仍然几乎不存在,这一定是有原因的。您对此有何见解?

This is a question further derived from a previous one: https://stackoverflow.com/questions/1834485/aspect-oriented-programming-aop-in-c-not-c-anyone-doing-it

The answers to that question point us to some research practices at queens university here:
http://sailhome.cs.queensu.ca/~bram/aspicere/index.html.

Beyond that research effort, does anyone know of real world usage of Aspect Oriented C in production code? If no, where do you think the difficulty is? If yes, what's the hurdle that makes it unpopular yet?

I think the benefit of AOP is obvious. But after AOP-Java becoming popular for a decade, AOP-C is still almost non-existent, there must be some reason. What's your insight on this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你是暖光i 2024-11-14 03:01:22

经过一番思考,我相信答案是 C 缺乏可以连接方面横切的结构构造。

为了解决这个问题,项目必须施加严格的结构约定,而程序员很难达成一致。如果确实有程序员同意这样的约定,那么该项目很可能会选择更好的语言。

After some thinking I believe the answer is that C lacks the structural constructs where you can hook up your aspect cross-cuts.

To get around of this problem, a project would have to impose strict structural conventions that is not easy to have programmers to agree on. If you do have programmers to agree on to such a convention, the chance is that the project would have chosen a better language.

面如桃花 2024-11-14 03:01:22

我认为主要原因是用 C/C++ 实现 AOP 的传统方法需要一个复杂的框架才能工作。
另外,C++是严格类型语言,这使得实现比C更困难。

但是,这是旧时代了。新的 C++ 11~17 提供了一些非常强大的功能,供您完成所有技巧。

你可以检查这个:https://github.com/whitebob/qaop
一个非常轻量级、仅包含头文件的 AOP 框架,并且易于使用。

我是这个正在进行的项目的作者,所以如果您有任何建议或抱怨,请与我联系:p

I think the main reason is that traditional method to implement the AOP in C/C++ needs a complex framework to make things work.
Beside, the C++ is strict type language, which makes the implementation even harder than C.

But, It is the old time. new C++ 11~17 provides some really powerful features for you to do all the tricks.

You could check this one: https://github.com/whitebob/qaop
A very light-weight, header-only AOP framework, and it is easy to use.

I am the author of this on-going project, so if you have some suggestions or complains, just contact me :p

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文