The #pragma is complier specified. for example, the code below does not work in gcc.

#pragma startup and #pragma exit:

#pragma startup func1
#pragma exit func2 void func1()
{
printf("Inside func1()\n");
} void func2()
{
printf("Inside func2()\n");
} int main()
{
printf("Inside main()\n"); return ;
}

in GCC, you can use

void __attribute__((constructor)) func1(); 
void __attribute__((destructor)) func2();  
 
#pragma warn Directive
in case there are some warning and you are sure it works as your expection and there is no any risk, you can use #pragma warn to disable it, but the code shall have a well document. 
#pragma warn +xxx (To show the warning)
#pragma warn -xxx (To hide the warning)
#pragma warn .xxx (To toggle between hide and show)
  • #pragma warn -rvl: This directive hides those warning which are raised when a function which is supposed to return a value does not return a value.
  • #pragma warn -par: This directive hides those warning which are raised when a function does not uses the parameters passed to it.
  • #pragma warn -rch: This directive hides those warning which are raised when a code is unreachable. For example: any code written after the return statement in a function is unreachable.

#pragma Directive in C/C++的更多相关文章

  1. 重新梳理HTML基础知识

    缘起 HTML(HyperText Markup Language超文本标记语言)是用于构建web页面的标记语言和通用标准.它并不是一项新的发明,因为超文本(具有超链接的文本)和标记语言(用于电子文档 ...

  2. C中的预编译宏定义

     可以用宏判断是否为ARC环境 #if _has_feature(objc_arc) #else //MRC #endif C中的预编译宏定义 -- 作者: infobillows 来源:网络 在将一 ...

  3. How do I place a group of functions or variables in a specific section?

    http://supp.iar.com/Support/?Note=27498 EWARM v5.xx (and newer) The placement of a few functions in ...

  4. RFC 2616

    Network Working Group R. Fielding Request for Comments: 2616 UC Irvine Obsoletes: 2068 J. Gettys Cat ...

  5. 基于NodeJs的网页爬虫的构建(一)

    好久没写博客了,这段时间已经忙成狗,半年时间就这么没了,必须得做一下总结否则白忙.接下去可能会有一系列的总结,都是关于定向爬虫(干了好几个月后才知道这个名词)的构建方法,实现平台是Node.JS. 背 ...

  6. scanf()常犯错误

    ------------------------------------------------------------------------ <> 本意:接收字符串. 写成代码:voi ...

  7. RFC2616-HTTP1.1-Header Field Definitions(头字段规定部分—单词注释版)

    part of Hypertext Transfer Protocol -- HTTP/1.1RFC 2616 Fielding, et al. 14 Header Field Definitions ...

  8. HTML5 Differences from HTML4

    Abstract "HTML5 Differences from HTML4" describes the differences of the HTML5 specificati ...

  9. C预编译, 预处理, C/C++头文件, 编译控制,

    在所有的预处理指令中,#Pragma 指令可能是最复杂的了,它的作用是设定编译器的状态或者是指示编译器完成一些特定的动作.#pragma指令对每个编译器给出了一个方法,在保持与C和C++语言完全兼容的 ...

随机推荐

  1. 强化学习10-Deep Q Learning-fix target

    针对 Deep Q Learning 可能无法收敛的问题,这里提出了一种  fix target 的方法,就是冻结现实神经网络,延时更新参数. 这个方法的初衷是这样的: 1. 之前我们每个(批)记忆都 ...

  2. string使用方法

    转载自:https://blog.csdn.net/tengfei461807914/article/details/52203202 使用场合: string是C++标准库的一个重要的部分,主要用于 ...

  3. 70 多表查询的分组F 聚合 Q 查询

    聚合查询和分组查询 聚合 aggregate()是QuerySet 的一个终止子句,意思是说,它返回一个包含一些键值对的字典.键的名称是聚合值的标识符,值是计算出来的聚合值.键的名称是按照字段和聚合函 ...

  4. centos服务器删除/usr目录怎么办

    凉拌 两种方法: 第一:重装系统,因为你的大部分命令使用不了了,如果你的服务器还有应用程序在跑,那你的服务也会有问题,因为一些服务的lib包也会放在此目录下,貌似需要重新装才可以 第二:利用ios镜像 ...

  5. python Django rest-framework 创建序列化工程步骤

    11创建项目 2创建应用 3stting添加应用(apps)-添加制定数据库-修改显示汉字(zh-hans)-上海时区(Asia/Shanghai) 4主路由添加子路由 5应用里创建子路由 6创建数据 ...

  6. Python 默认值字典

    from collections import defaultdict # 默认值字典 dd = defaultdict(lambda: "胡辣汤") # callable 可调用 ...

  7. Puppet的一些奇技淫巧

    puppet这个工具真的很神奇,先不说商业版有哪些黑科技,单是开源版本就有很多可能让你摸不着头脑的地方,下面来列举一下puppet是怎么查找puppet server的 其实很简单,puppet ag ...

  8. 自动化测试-22.RobotFrameWork鼠标和键盘的操作针对出现window界面的处理

    键盘和鼠标的操作:使用AutoItLibrary模块 1.安装pywin32 http://sourceforge.net/projects/pywin32/files/pywin32/Build%2 ...

  9. JS执行机制--事件循环--笔记

    JS的解析是由浏览器中的JS解析引擎完成的.JS是单线程运行,也就是说,在同一个时间内只能做一件事,所有的任务都需要排队,前一个任务结束,后一个任务才能开始.但是又存在某些任务比较耗时,如IO读写等, ...

  10. SQL注入之Sqli-labs系列第十三关(基于单引号POST的报错注入)

    开始挑战第十三关(Double Injection- String- with twist) 访问地址,输入报错语句 '  ''  ')  ") - 等使其报错 分析报错信息 很明显是需要采 ...