C/C++µÄÌõ¼þ±àÒë
ÒÔΪÒѾÕÆÎÕÌõ¼þ±àÒ룬Ԥ±àÒëµÄÒªÁìÁË£¬½á¹û»¹ÊÇ´æÔںܶàÒÅ©µÄµØ·½£¬ËùÒÔ¹æÕûһϣº
Ìõ¼þ±àÒ룺
1
#ifdef _XXXX
...³ÌÐò¶Î1...
#else
...³ÌÐò¶Î2...
#endif
Õâ±íÃ÷Èç¹û±êʶ·û_XXXXÒѱ»#defineÃüÁÒå¹ýÔò¶Ô³ÌÐò¶Î1½øÐбàÒ룻·ñÔò¶Ô³ÌÐò¶Î2½øÐбàÒë¡£
2
#ifndef _XXXX
...³ÌÐò¶Î1...
#else
...³ÌÐò¶Î2...
#endif
ÕâÀïʹÓÃÁË#ifndef£¬±íʾµÄÊÇif not def¡£µ±È»ÊǺÍ#ifdefÏà·´µÄ×´¿ö£¨Èç¹ûûÓж¨ÒåÁ˱êʶ·û_XXXX£¬ÄÇôִÐгÌÐò¶Î1£¬·ñÔòÖ´ÐгÌÐò¶Î2£©¡£
3
#if ³£Á¿
...³ÌÐò¶Î1...
#elif<³£Á¿±í´ïʽ2>
...³ÌÐò¶Î2...
#elif<³£Á¿±í´ïʽ3>
...³ÌÐò¶Î3...
... ...
#else
...³ÌÐò¶Î2...
#endif
ÕâÀï±íʾ£¬Èç¹û³£Á¿ÎªÕ棨·Ç0£¬Ëæ±ãʲôÊý×Ö£¬Ö»Òª²»ÊÇ0£©£¬¾ÍÖ´ÐгÌÐò¶Î1£¬·ñÔòÖ´ÐгÌÐò¶Î2¡£
ÀýÈç:
#if defined(_PC) && defined(_SSE)
# ifdef DEBUG
# define __PC_VERIFY_ALIGNMENT__
# endif
# ifdef __PC_VERIFY_ALIGNMENT__
# define PC_VERIFY_ALIGN_ASSERT( ptr ) \
{\
if( ( ( (INT) ptr ) % 16) != 0 ) \
{\
debugf( NAME_Critical, TEXT("Unaligned PC data (0x%X)"), ptr ); \
DebugBreak(); \
}\
}
# else
# define PC_VERIFY_ALIGN_ASSERT( ptr )
# endif
#else
# define PC_VERIFY_ALIGN_ASSERT( ptr )
#endif
ÔÙ̸µ½Ô¤±àÒëÃüÁî:
Ô¤´¦ÀíÆ÷ָʾ·û
Í·Îļþͨ¹ýinclude Ô¤´¦ÀíÆ÷ָʾ·ûpreprocessor include directive ¶ø³ÉΪÎÒÃdzÌÐòµÄ
Ò»²¿·ÖÔ¤´¦ÀíÆ÷ָʾ·ûÓÃ# ºÅ±êʶÕâ¸ö·ûºÅ½«·ÅÔÚ³ÌÐòÖиÃÐеÄ×îÆðʼһÁÐÉÏ´¦Àí
ÕâЩָʾ·ûµÄ³ÌÐò±»³Æ×öÔ¤´¦ÀíÆ÷preprocessor ͨ³£À¦°óÔÚ±àÒëÆ÷ÖÐ
#include ָʾ·û¶ÁÈëÖ¸¶¨ÎļþµÄÄÚÈÝËüÓÐÁ½ÖÖ¸ñʽ
#include <some_file.h>
#include "my_file.h"
Èç¹ûÎļþÃûÓüâÀ¨ºÅ< ºÍ> À¨ÆðÀ´±íÃ÷Õâ¸öÎļþÊÇÒ»¸ö¹¤³Ì»ò±ê׼ͷÎļþ²é
ÕÒ¹ý³Ì»á¼ì²éÔ¤¶¨ÒåµÄÄ¿Â
Ïà¹ØÎĵµ£º
Ô´Â룺
/* ʹÓÃÑ¡Ôñ·¨ÅÅÐò */
# include <stdio.h>
int main()
{
int i, j, min, temp;
/* ¶¨ÒåÒ»¸öÕûÐ͵ÄһάÊý×é */
int array[10];
/* ÊäÈëÊý¾Ý */
printf("Please input ten integ ......
Ô´Â룺
# include <stdio.h>
int main()
{
/* Óгߴç */
/* һάÕûÐÎÊý×é³õʼ»¯ */
int array1[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
/* һά×Ö·ûÐÍÊý×é³õʼ»¯£¬×îºóÒ»¸öÔªËØ×Ô¶¯Ìí¼ÓΪ‘/0 ......
ÎÄ˼ÐÅÏ¢¼¼ÊõÓÐÏÞ¹«Ë¾www.vanceinfo.com£¨Å¦½»ËùÉÏÊдúÂ룺VIT£©³ÉÁ¢ÓÚ1995Ä꣬ÊÇÒ»¼ÒÐÅÏ¢¼¼Êõ·þÎñÌṩÉ̼°ÔÚÖйú¾ÓÁìÏȵØλµÄÀë°¶Èí¼þ¿ª·¢¹«Ë¾Ö®Ò»¡£ÎÄ˼ÊǵÚÒ»¼ÒÔÚŦԼ¹ÉƱ½»Ò×ËùÉÏÊеÄÖйúÈí¼þ·þÎñÍâ°üÆóÒµ¡£¾Ý¹ú¼ÊÊý¾Ý¹«Ë¾(IDC)µÄͳ¼Æ, ÒÔ2007ÄêÏúÊÛ¶îºâÁ¿, ÎÄ˼ÐÅÏ¢¼¼ÊõÔÚΪŷÃÀÊг¡ÌṩÀë°¶Èí¼þ¿ª·¢ÐÐÒµÖÐλ¾ÓÖйúµÚÒ ......
C Sharp(C#)ÖÐÈçºÎɾ³ýÎļþ(Îļþ¼Ð)
Ö±½Óɾ³ý:
using System.IO;
...
string filePath = @"D:\...\xxx.xxx";
if (File.Exists(filePath))
{
File.Delete(filePath);
}
else
{
Console. ......
¼´Ê¹½«VirtualBox°²×°µ½±ðµÄÅÌÉÏ£¬Æä×ö³ÉµÄÐéÄâ»ú£¨ÏµÍ³£¬Ó²ÅÌ£©ÈÔ»áĬÈÏÉú³Éµ½ÏµÍ³ÅÌ£¬Ä¬ÈÏC:ÅÌÉÏ£¬Ëæ×ÅÐé»úÊýÁ¿ºÍÄÚÈÝÔö¼Ó¼·Õ¼Á˱¾À´¾Í²»´óµÄϵͳÅ̿ռ䣬ºÜÊDz»±ã¡£
¿ªÊ¼½«C:ÅÌÏÂ.VirtualBoxĿ¼ÏµĶ«Î÷È«ÅÌ¿½±´ÖÁ±ð´¦,È»ºóÔÚVirtualBoxµÄÎļþ/»·¾³ÉèÖà Öн«¡ºÄ¬ÈÏÓ²ÅÌĿ¼¡»ºÍ¡ºÄ¬ÈϼÙÏë»úÆ÷¡»×öÏàÓ¦µÄÐÞ ......