如何在函数体内的url被编译 [英] how does url within function body get compiled

查看:93
本文介绍了如何在函数体内的url被编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚粘贴了一个url到我的代码,并忘记了评论,但我很惊讶地看到MSVC ++编译成功。我的代码是这样,

I just pasted a url to my code, and forgot to comment it, but I was surprised to see MSVC++ compiled it successfully. My code is like this,

void my_function()
{
    http://www.google.co.in/
}

如何通过MSVC ++编译?

How come this gets compiled by MSVC++?

推荐答案

实际上, http 后跟作为标签处理,您可以在 goto 语句(如 goto http; ),其余部分(即 // www.google.co.in )被视为单行注释。

Actually, http followed by a colon is treated as a label by C++, which you can use in goto statements (like goto http;), and the rest (i.e //www.google.co.in) is treated as single line comment. That's why it gets compiled.

查看更多,

 void your_function()
 {

        http://www.google.co.in/

        https://www.crazy_c++.com/

        ftp://c++_is_fun.edu

        //your code here
        int i = 10 ; //atleast one line of code is needed here to get compiled!
 }






不要以为你写的例子会编译。应该有至少一行代码在url之后,只有那时它被编译在我的电脑上。我使用MSVC ++ 2008.


By the way, I don't think the example you've written would get compiled. There should be at least one line of code after the url, only then it gets compiled on my PC. I'm using MSVC++ 2008.

这篇关于如何在函数体内的url被编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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