小编ham*_*ene的帖子

它来自哪里: - * - 编码:utf-8 - * -

Python将以下内容识别为定义文件编码的指令:

# -*- coding: utf-8 -*-
Run Code Online (Sandbox Code Playgroud)

我确实在(-*- var: value -*-)之前看过这种指令.它从何而来?什么是完整的规范,例如,值可以包括空格,特殊符号,换行符,甚至-*-本身?

我的程序将编写纯文本文件,我想使用这种格式在其中包含一些元数据.

python emacs encoding text file

123
推荐指数
3
解决办法
8万
查看次数

海湾合作委员会:关于"控制到非空函数结束"的中断编译

当我添加

#pragma GCC diagnostic error "-Wreturn-type"
Run Code Online (Sandbox Code Playgroud)

编译器产生警告,而不是每个缺失的错误return.如何将此特定警告变为错误?

测试代码:

#pragma GCC diagnostic error "-Wreturn-type"

int foo(int x)
{
    if (x) return 8;
}

int main(int narg, char* arg[])
{
    foo(narg);
}
Run Code Online (Sandbox Code Playgroud)

我试过了

i686-apple-darwin10-g ++ - 4.2.1(GCC)4.2.1(Apple Inc. build 5666)(第3点)

i686-apple-darwin10-llvm-g ++ - 4.2(GCC)4.2.1(基于Apple Inc. build 5658)(LLVM build 2335.6)

更新:我-Werror=return-type按照@sastraxi的建议尝试过,但效果相同.

c c++ gcc g++

3
推荐指数
1
解决办法
1027
查看次数

标签 统计

c ×1

c++ ×1

emacs ×1

encoding ×1

file ×1

g++ ×1

gcc ×1

python ×1

text ×1