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. ubuntu下修改MYSQL数据库密码

    在介绍修改密码之前,先介绍一个文件/etc/MySQL/debian.cnf.其主要内容如下图: 里面有一个debian-sys-maint用户,这个用户只有Debian或Ubuntu服务器才有,所以 ...

  2. VSTO:使用C#开发Excel、Word【6】

    Office主互操作程序集(PIA)在了解如何构建Office解决方案之前,您需要更详细地了解在.NET中与Office对象模型通信的托管程序集.用于与Office通话的托管程序集称为Office主互 ...

  3. VSTO - 使用Excel加载项生成表和图表

    此示例显示如何创建Excel的加载项,使用户可以在其工作表中选择库存符号,然后生成一个新工作表,显示库存的历史性能. 工作表包含数据表和图表. 介绍Excel加载项通常不知道工作表包含什么.典型的加载 ...

  4. HashMap中hashCode()和equals()重要性

    Java中HashMap根据hashCode()和equals()方法来获取键值对的索引,同时也通过这两个方法由key值获取value值.如果没有这两个方法,那么当有两个相同的 hash值时,可能会被 ...

  5. 重载的方式写Python的post请求

    #encoding=utf-8#__author__="Lanyangyang" import unittestimport requestsimport json # This ...

  6. do while

    do while结构的基本原理和while结构是基本相同的,但是它保证循环体至少被执行一次.因为它是先执行代码,后判断条件,如果条件为真,继续循环.

  7. WebService的一种简单应用方式入门

    1.什么是WebService? WebService即Web服务,简单来讲,他就是一种跨编程语言和跨操作平台的远程调用技术. 2.Web服务: Web服务是基于HTTP和XML的技术:HTTP是互联 ...

  8. kbmMW 5.07.00试用笔记

    在kbmMW 5.06.20试用笔记中遇到的问题,在这个版本中,基本都解决了.但还是发现修正后存在的小问题及新问题: 1.Resolve返回值错误 当提交的ClientQuery是执行一条sql语句, ...

  9. 使用git下载源码及数据文件

    初学git,用来下载github上的数据和源代码,具体步骤如下. 1.百度搜索git并下载:本想从github直接下载安装,无奈国外服务器的下载速度太慢,建议国内的直接搜索下载完整安装版. 2.完成g ...

  10. Java NIO系列教程

    http://ifeve.com/overview/ http://tutorials.jenkov.com/java-nio/nio-vs-io.html