开发人员为什么要使用宏? [英] Why would a developer use a macro?

查看:152
本文介绍了开发人员为什么要使用宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 为什么会显影剂使用?
  • 使用它们的优点和缺点是什么?
  • 在哪里可以找到一些资源以及如何使用它们?

推荐答案

宏是一个非常广泛的术语.在C ++中,例如,有宏例如这些.从软件开发的角度来看,它们使您可以使用这些便捷宏(例如__FILE__)来完成某些事情,例如获取当前源文件的名称等.

Macros is a pretty broad term. In C++, for example, there are macros such as these. From a software development perspective, they allow you to use these convenience macros (__FILE__, for example) to do certain things, like get the name of the current source file, etc.

还有一些击键宏,您可以在编辑器中记录这些宏.举例来说,如果你要编辑一个文件的每一行,并用引号括起来,你可以录制一系列按键来做到这一点,然后保存"宏向一个键.然后,您可以按该键,它将执行您刚刚为文件中的每一行保存的所有击键.

There are also keystroke macros you can record in an editor. For example, if you are going to edit each line of a file and surround it with quotes, you could record a series of keystrokes to do that, and then "save" the macro to a single key. Then you could press that key which would execute all the keystrokes you just saved for each line in the file.

这篇关于开发人员为什么要使用宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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