什么是布尔标志 [英] What is a boolean flag

查看:563
本文介绍了什么是布尔标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在参加Visual Basic 2010课程,我正试图掌握这个名为旗帜的新术语。我有点明白它与布尔条件有关。我不太清楚旗帜是什么。我看到使用术语flag的引用。我理解当布尔值,条件触发标志时,它有一些事情要做。但是旗帜是什么。你是如何识别它的?有人可以给我一个例子。

解决方案

一般来说,Flag只是真/假条件的另一个术语。 / p>

在更具体的背景下,它可能具有更具体的含义。例如,CPU可以保持算术标志,每个算术标志指示由先前的算术运算产生的真/假条件。例如,如果前一个操作是ADD,则标志将指示添加的结果是零,小于零还是大于零。



我认为该术语来自用于表示通过/不通过状态的标志,例如,铁路旗手指示列车是否安全进行。


I'm taking a course in Visual Basic 2010 and I'm trying to get a grasp on this new term called a flag. I kind of understand that it has something to do with a boolean condition. I don't quite understand what a flag is. I see references to it using the term flag. I understand it has something to do when a boolean, a condition triggers a flag. But what is the flag. How do you identify it? Can somebody give me an example.

解决方案

In general, "Flag" is just another term for a true/false condition.

It may have more specific meanings in more specific contexts. For instance, a CPU may keep "arithmetic flags", each one indicating a true/false condition resulting from the previous arithmetic operation. For instance, if the previous operation was an "ADD", then the flags would indicate whether the result of the add was zero, less than zero, or greater than zero.

I believe the term comes from flags used to signal a go/no go condition, like, a railroad flagman indicating whether or not it is safe for the train to proceed.

这篇关于什么是布尔标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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