Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C ÖÐ extern ºÍ static

CÓïÑÔÖУº
extern £ºextern£¨ÍⲿÒýÓã©¿ÉÒÔÖÃÓÚ±äÁ¿»òÕߺ¯ÊýÇ°£¬ÒÔ±êʾ±äÁ¿»òº¯ÊýµÄ¶¨ÒåÔÚ±ðµÄÎļþÖУ¬ÔÚÒ»¸öÎļþÖÐÓõ½µÄexternÕâЩ±äÁ¿»òº¯ÊýÊÇÍâÀ´µÄ£¬²»ÊDZ¾Îļþ¶¨ÒåµÄ£¬Ìáʾ±àÒëÆ÷Óöµ½´Ë±äÁ¿ºÍº¯ÊýʱÔÚÆäËûÄ£¿éÖÐÑ°ÕÒÆ䶨Òå¡£×¢Ò⣬ֻÓÐÆäËûÎļþÖеÄÈ«¾Ö±äÁ¿²ÅÄܱ»ÆäËûÎļþËùextern¡£
extern int val;
×¢£º
      ´Ë´¦µÄº¯ÊýÀàÐÍ¿ÉÒÔÊ¡ÂÔ£¬¼´extern val;
      ÒòΪexternµÄ×÷ÓþÍÊǸæËß±àÒëÆ÷Õâ¸ö±äÁ¿ÊÇÔÚÆäËûÎļþÖж¨ÒåµÄ£¨ÊÇÍâÔ®£©¡£±àÒëÆ÷ÊÇÏàÐÅ×Ô¼ºÈ˵ģ¬ËùÒÔÔÚ±àÒëµÄʱºòÒªÊÇ¿´µ½val±äÁ¿Ê±»áÈÏΪËüÊÇ´æÔÚ£¬²»»á±¨´í¡£Ö»ÓÐÔÚÁ´½ÓµÄʱºòÁ´½ÓÆ÷²Å»áÈ¥ÆäËüobjÎļþÖÐÑ°ÕÒval±äÁ¿µÄ¶¨Ò壨µØÖ·£©£¬ÕÒµ½Ôò˳ÀûÁ´½Ó£¬·ñÔò±¨´í¡£ÒòΪ±àÒëÆ÷Ö»ÐèÒªÖªµÀexternËùÉùÃ÷±äÁ¿µÄÃû×־ͿÉÒÔÁË£¬ËùÒÔextern int val ¿ÉÒÔд³É extern val(¼´Ê¡ÂÔ±äÁ¿ÀàÐÍ)¡£ 
      ÖÁÓÚ extern“C”µÄÓ÷¨£¬ Ò»°ãÈÏΪÊôÓÚ C++µÄ·¶³ë¡£externÊÇC/C++ÓïÑÔÖбíÃ÷º¯ÊýºÍÈ«¾Ö±äÁ¿×÷Ó÷¶Î§£¨¿É¼ûÐÔ£©µÄ¹Ø¼ü×Ö£¬µ«ÔÚC++ÖÐΪÁ˼æÈÝÃæÏò¹ý³ÌÓïÑÔ£¨C£©£¬À©Õ¹ÁËextern¹¦ÄÜ¡£
static : ÔÚCÖУ¬static£¨¾²Ì¬µÄ£©Ö÷ÒªÓÐÁ½¸ö×÷Ó㺠ÐÞÊαäÁ¿ºÍÐÞÊκ¯Êý¡£ÔÚC++ÖУ¬static¹¦Äܵõ½ÁËÀ©Õ¹¡£
µÚÒ»¸ö×÷ÓãºÐÞÊαäÁ¿¡£±äÁ¿ÓÖ·ÖΪ¾Ö²¿ºÍÈ«¾Ö±äÁ¿£¬µ«ËüÃǶ¼´æÔÚÄÚ´æµÄ¾²Ì¬Çø(È«¾ÖÇø)¡£
¡ñ¾²Ì¬È«¾Ö±äÁ¿£¬×÷ÓÃÓò½öÏÞÓÚ±äÁ¿±»¶¨ÒåµÄÎļþÖУ¬ÆäËûÎļþ¼´Ê¹Óà externÉùÃ÷Ҳû·¨Ê¹ÓÃËû¡£×¼È·µØ˵×÷ÓÃÓòÊÇ´Ó¶¨ÒåÖ®´¦¿ªÊ¼£¬µ½Îļþ½áβ´¦½áÊø£¬ÔÚ¶¨ÒåÖ®´¦Ç°ÃæµÄÄÇЩ´úÂëÐÐÒ²²»ÄÜʹÓÃËü¡£ÏëҪʹÓþ͵ÃÔÚÇ°ÃæÔÙ¼Ó extern *** »ò¸É´à¶¨ÒåÔÚÎļþ¶¥¶Ë¡£
¡ñ¾²Ì¬¾Ö²¿±äÁ¿£¬ÔÚº¯ÊýÌåÀïÃ涨ÒåµÄ£¬¾ÍÖ»ÄÜÔÚÕâ¸öº¯ÊýÀïÓÃÁË£¬Í¬Ò»¸öÎĵµÖеÄÆäËûº¯ÊýÒ²Óò»ÁË¡£ÓÉÓÚ±» staticÐÞÊεıäÁ¿×ÜÊÇ´æÔÚÓÚÄÚ´æµÄ¾²Ì¬Çø£¬ËùÒÔ¼´Ê¹Õâ¸öº¯ÊýÔËÐнáÊø£¬Õâ¸ö¾²Ì¬±äÁ¿µÄÖµ»¹ÊDz»»á±»Ïú»Ù£¬º¯ÊýÏ´ÎʹÓÃʱÈÔÈ»ÄÜÓõ½Õâ¸öÖµ¡£
Àý£ºstatic int j ;
void fun1(void)
{
static int i = 0;
i++;
}
void fun2(void)
{
j = 0;
j++;
}
int main()
{
for(int k=0; k<10; k++)
{
fun1();
fun2();
}
return 0;
}
i ºÍ jµÄÖµ·Ö±ðÊǶàÉÙ£¬ÎªÊ²Ã´£¿
ÕâÀÔÚº¯Êýfun1ÖÐÉùÃ÷ÁËi£¬¶ø²»ÊǶ¨ÒåÁËi£¬Ò²¾ÍÊǸæËß±àÒëÆ÷£¬i Õâ¸öÃû×ÖÒѾ­Æ¥Åäµ½Ò»¿éÄÚ´æÉÏÁË£¬²¢ÇÒÔÚ¾²Ì¬ÄÚ´æÇø¡


Ïà¹ØÎĵµ£º

JAVA²Ù×÷XMLµÄÍêÕûÀý×Ó——W3C DOMƪ

ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
 <book>
  <name>¹þÀï²¨Ì ......

VCÖбàÒëÓÐCÔ´ÎļþµÄ³ÌÐò

×î½üÔÚ×ö³ÌÐòʱÐèҪʹÓÃÒ»¸öÒѾ­±àºÃµÄC³ÌÐòÔ´Îļþ£¨ÓÐÍ·Îļþ£©£¬½«Í·Îļþ¼ÓÈëÒªµ÷ÓõÄÔ´ÎļþÖУ¬µ÷ÓÃÏàÓ¦Cº¯Êý£¬±àÒëʱ³öÏÖÈçÏ´íÎó£º
sss.c(3129) : fatal error C1010: unexpected end of file while looking for precompiled header directive
ÔÚÍøÉϲéÁËÏà¹Ø×ÊÁÏ£¬Ëµ²»ÄÜÔÚCÔ´ÎļþÖаüº¬"stdafx.h"Îļþ£¬
ÖªµÀÐèÒªÒ ......

CÓëshell»ìºÏ±à³Ì


ÔÚlinuxÉÏд³ÌÐò¡¢×öÍø¹ÜµÄÈË£¬»ò¶à»òÉÙ¶¼»á¼¸Öֽű¾¡£½Å±¾ÓïÑÔÁé»îµÄ±äÁ¿ÀàÐÍ¡¢Ç¿´óµÄÕýÔò±í´ïʽ´¦ÀíÄÜÁ¦£¬ÔÙ¼ÓÉÏlinuxϵͳ±¾ÉíµÄ¹ÜµÀ¡¢Öض¨ÏòÒÔ¼°·á¸»µÄÃüÁîÐй¤¾ß£¬ÈÃÄã±à³ÌÆðÀ´ÓÎÈÐÓÐÓà¡£
¡¡¡¡¶øCÓïÑÔ¹ÌÈ»ÓÐÖÖÖÖÓÅÊÆ£¬µ«²»¿É·ñÈÏ£¬ºÜ¶à³¡ºÏÏ£¬Óýű¾ÓïÑÔ¸üΪ·½±ã£¬±ÈÈçÎÒÃǽ«¾ÙÀý˵Ã÷µÄ¶ÔÅäÖÃÎļþµÄ´¦Àí¡£
¡¡¡¡ÏÈ ......

C# C/S³ÌÐò³ö´í£ºContextSwitchDeadlock is detected

½ñÌìÔÚVS2005µ÷ÊÔÒ»¸öC# C/S³ÌÐò£¬µ±Í¨¹ýRFCÓëSAPÁ¬½Óʱ¼ä¹ý³¤Ê±£¬³öÏÖ´Ë´íÎó£¬ÔÚÍøÉÏÕÒµ½½â¾ö°ì·¨¡£
VS2008ÉϵÄÒ»¸ö³ÌÐò£¬Í¨¹ýOracle.DataAccess.dllÖ´ÐÐdrop user
cascade²Ù×÷£¬ÎÒÔÚsqlplusÖ´Ðд˲Ù×÷´óÔ¼ÐèÒªÒ»·ÖÖÓ×óÓÒʱ¼ä£¬µ±ÎÒÔÚVS2008ÖÐdebugÆô¶¯´Ë³ÌÐòʱ£¬Ò»Ö±½ÓÊÕµ½
“ContextSwitchDeadlock is detected& ......

CºÍC++»ìºÏ±à³Ì(__cplusplus Óë external "c" µÄʹÓÃ)

http://www.diybl.com/course/3_program/c++/cppjs/20090403/163906.html
CºÍC++»ìºÏ±à³Ì(__cplusplus Óë external "c" µÄʹÓÃ)
www.diybl.com¡¡Ê±¼ä£º2009-04-03¡¡×÷Õß:ÄäÃû ±à¼­:sky µã»÷£º¡¡124 [ÆÀÂÛ]
µÚÒ»ÖÖÀí½â
±ÈÈç˵ÄãÓÃC++¿ª·¢ÁËÒ»¸öDLL¿â£¬ÎªÁËÄܹ»ÈÃCÓïÑÔÒ²Äܹ»µ÷ÓÃÄãµÄDLLÊä³ö(Export)µÄº¯Êý£¬ÄãÐèÒªÓÃexte ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ