这个“标签"是什么意思?在C ++中意味着什么? [英] What does this "label" mean in C++?

查看:92
本文介绍了这个“标签"是什么意思?在C ++中意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读一些C ++代码,并且看到了一些有趣的东西.

I was reading some c++ code, and i saw something interesting.

代码是这样的:

repeat:
    ...code here....
fallback:
    ...code here....
start:
        ....another code....

这是我第一次在c ++代码中看到这种标签",我称之为标签cos,我在汇编代码中看到了类似的东西,其中代码被分成带有不同标题且以冒号结尾的部分.

This is the first time i am seeing this kind of "labels" in c++ code, i called the labels cos i have seen something similar in assembly code where the code is divided into sections with different titles which end with colon.

我想问你这是什么意思,它有什么用?

I am asking you what does that mean, and of what use it can be ?

推荐答案

它是一个标签,您可以使用 goto 跳转到该标签.

It is a label, to which you can jump using a goto.

在程序中是否应该使用 goto 是完全另一回事.

Whether one should use gotos in a program is another matter entirely.

这篇关于这个“标签"是什么意思?在C ++中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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