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. 用servlet实现用户登录案例

    以下实现登录窗口 Login.jsp <!--Login.jsp--> <%@ page language="java" import="java.ut ...

  2. Java基础-语法定义

    Java三个体系 Java SE(Java Platform,Standard Edition).Java SE 以前称为 J2SE.它允许开发和部署在桌面.服务器.嵌入式环境和实时环境中使用的 Ja ...

  3. shell脚本实例-内存磁盘使用警告

    1,磁盘使用警告并发送邮件 #!usr/bin/bash #df -Th|grep '/$' 这个是获取内存使用的那一条记录 #后面两句是获取内存的使用率 disk=`df -Th|grep '/$' ...

  4. vue中七牛插件使用

    <template> <div id="cxUpload" class="cx-upload"> <button id=" ...

  5. kbmMW User authentication

    任何信息系统的一个非常重要的部分是能够对用户进行身份验证. kbmMW在这里提供了非常强大的机制. TkbmMWSimpleClient提供简单的用户身份验证机制,您可以在连接到应用程序服务器时传递U ...

  6. Python 类的约束

    # 项目经理 class Base: # 对子类进行了约束. 必须重写该方法 # 以后上班了. 拿到公司代码之后. 发现了notImplementedError 继承他 直接重写他 def login ...

  7. react native 之 Android物理返回键

    基本用法 根据文档,安卓back键的处理主要就是一个事件监听: BackAndroid.addEventListener('hardwareBackPress', this.onBackPressed ...

  8. RIP路由协议(一)

    实验要求:使用RIPv2配置路由器,使路由器能接收到所有的路由条目 拓扑如下: 配置如下: R1enable 进入特权模式configure terminal 进入全局模式interface s0/0 ...

  9. MySQL笔记(2)

    SQL 的约束 约束是一种限制,它通过对表的行或列的数据做出限制,来确保表的数据的完整性.唯一性.. 1 约束分类 约束是一种限制,它通过对表的行或列的数据做出限制,来确保表的数据的完整性.唯一性. ...

  10. v$、v_$、gv$之间的关系

    本次实验测试,oracle数据库视图中v$,v_$,gv$之间的关系 总结: v_$是动态性能视图,通过sql查询数据库基表返回记录.例如,v_$database对象是视图类型,可对其它用户授权访问: ...