zoukankan      html  css  js  c++  java
  • extern

    extern

    extern关键字

    extern declarator      // used when variable or function has external linkage
    extern 声明               //   当变量或函数有外部的联接时使用

    extern
    string-literal declarator      // used when linkage conventions of another
                              // language are being used for the declarator
    extern string类型 声明            //   当其他语言的联接约定被用来作为声明符时使用

    extern string-literal { declarator-list }   // used when linkage conventions of another
                             // language are being used for the declarators
    extern string类型{声明符列表} 声明            //   当其他语言的联接约定被用来作为声明符时使用


    The extern keyword declares a variable or function and specifies that it has external linkage (its name is visible from files other than the one in which it's defined). When modifying a variable, extern specifies that the variable has static duration (it is allocated when the program begins and deallocated when the program ends). The variable or function may be defined in another source file, or later in the same file. In C++, when used with a string, extern specifies that the linkage conventions of another language are being used for the declarator(s).
    extern 关键字声明一个变量或者函数,它包含外部联接(它的名字对文件来说是可见的,不同于在定义时不可见)。
    当更改一个变量时,extern 指定变量为 静态生命期(也就是说当程序运行时分配,程序结束时被收回)。
    变量或者函数可能被定义在另外一个源文件中,或者在同一个文件的后面部分。在C++中,当使用一个string(字符串)时,extern 指定其他语言的联接约定被用来作为声明符时使用


    Declarations of variables and functions at file scope are external by default.
    默认情况下,在文件域中声明变量和函数是外部的。

    In C++, string-literal is the name of a language. The language specifier "C++" is the default. "C" is the only other language specifier currently supported by Microsoft C/C++. This allows you to use functions or variables defined in a C module.
    在C++中,string串 是一个关键字。


    All of the standard include files use the extern "C" syntax to allow the run-time library functions to be used in C++ programs.

    For more information, see auto, register, static, const, and volatile.

    Example

    The following example declares the functions printf, getchar, and putchar with “C” linkage:

    // Example of the extern keyword
    extern "C" int printf( const char *, ... );
    
    extern "C"
    {
       int getchar( void );
       int putchar( int );
    }
  • 相关阅读:
    选择器的使用总结
    突出展示
    京东轮播图的·实现方式
    jquery实现下拉菜单
    jquery实现淘宝动态图展示商品
    jquery查找子元素和兄弟元素
    调制解调
    同步异步串行并行
    Quartus ii 初学遇到的问题以及解决
    PLL
  • 原文地址:https://www.cnblogs.com/ctoroad/p/394263.html
Copyright © 2011-2022 走看看