语言如何扩展? [英] How does a language expand itself?

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

问题描述

我正在学习C ++,我刚开始学习一些 Qt 的功能来编码GUI程序。我问自己以下问题:

I am learning C++ and I've just started learning about some of Qt's capabilities to code GUI programs. I asked myself the following question:

如何C ++,以前没有语法能够要求操作系统的窗口或方式通过网络通信我也不完全明白,我承认)突然得到这样的能力通过C ++自己写的图书?这一切似乎是非常可怕的给我。

How does C++, which previously had no syntax capable of asking the OS for a window or a way to communicate through networks (with APIs which I don't completely understand either, I admit) suddenly get such capabilities through libraries written in C++ themselves? It all seems terribly circular to me. What C++ instructions could you possibly come up with in those libraries?

我意识到这个问题对于一个经验丰富的软件开发人员来说可能是微不足道的,但我一直在研究几个小时没有找到任何直接反应。因为库的存在对我来说是不可理解的。

I realize this question might seem trivial to an experienced software developer but I've been researching for hours without finding any direct response. It's gotten to the point where I can't follow the tutorial about Qt because the existence of libraries is incomprehensible to me.

推荐答案

计算机就像洋葱,它有许多,从纯硬件的内核到最外层的应用层。每个层将其自身的部分暴露给下一个外层,使得外层可以使用一些内层功能。

A computer is like an onion, it has many many layers, from the inner core of pure hardware to the outermost application layer. Each layer exposes parts of itself to the next outer layer, so that the outer layer may use some of the inner layers functionality.

例如, Windows操作系统为在Windows上运行的应用程序公开了所谓的WIN32 API。 Qt库使用该API提供使用Qt的应用程序自己的API。你使用Qt,Qt使用WIN32,WIN32使用较低级别的Windows操作系统,依此类推,直到它的硬件电信号。

In the case of e.g. Windows the operating system exposes the so-called WIN32 API for applications running on Windows. The Qt library uses that API to provide applications using Qt to its own API. You use Qt, Qt uses WIN32, WIN32 uses lower levels of the Windows operating system, and so on until it's electrical signals in the hardware.

这篇关于语言如何扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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