C/C++ assert() º¯ÊýÓ÷¨
assert
º¯ÊýÃû: assert
¹¦ ÄÜ: ²âÊÔÒ»¸öÌõ¼þ²¢¿ÉÄÜʹ³ÌÐòÖÕÖ¹
ÓÃ ·¨: void assert(int test);
³ÌÐòÀý:
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
struct ITEM {
int key;
int value;
};
/* add item to list, make sure list is not null */
void additem(struct ITEM *itemptr) {
assert(itemptr != NULL);
/* add item to list */
}
int main(void)
{
additem(NULL);
return 0;
}
assert(¶ÏÑÔ)¿ÉÒÔÓÐÁ½ÖÖÐÎʽ£º
assert Expression1 ;
assert Expression1 : Expression2 ;
Expression1 Ó¦¸Ã×ÜÊDzúÉúÒ»¸ö²¼¶ûÖµ¡£
Expression2 ¿ÉÒÔÊǵóöÒ»¸öÖµµÄÈÎÒâ±í´ïʽ¡£Õâ¸öÖµÓÃÓÚÉú³ÉÏÔʾ¸ü¶àµ÷ÊÔÐÅÏ¢µÄ String ÏûÏ¢¡£
¶ÏÑÔÔÚĬÈÏÇé¿öÏÂÊǽûÓõġ£ÒªÔÚ±àÒëʱÆôÓöÏÑÔ£¬ÐèҪʹÓà source 1.4 ±ê¼Ç£º
javac -source 1.4 Test.java
ÒªÔÚÔËÐÐʱÆôÓöÏÑÔ£¬¿ÉʹÓà -enableassertions »òÕß -ea ±ê¼Ç¡£
ÒªÔÚÔËÐÐʱѡÔñ½ûÓöÏÑÔ£¬¿ÉʹÓà -da »òÕß -disableassertions ±ê¼Ç¡£
ҪϵͳÀàÖÐÆôÓöÏÑÔ£¬¿ÉʹÓà -esa »òÕß -dsa ±ê¼Ç¡£»¹¿ÉÒÔÔÚ°üµÄ»ù´¡ÉÏÆôÓûòÕß½ûÓöÏÑÔ¡£
¿ÉÒÔÔÚÔ¤¼ÆÕý³£Çé¿öϲ»»áµ½´ïµÄÈκÎλÖÃÉÏ·ÅÖöÏÑÔ¡£¶ÏÑÔ¿ÉÒÔÓÃÓÚÑéÖ¤´«µÝ¸ø˽Óз½·¨µÄ²ÎÊý¡£²»¹ý£¬¶ÏÑÔ²»Ó¦¸ÃÓÃÓÚÑéÖ¤´«µÝ¸ø¹«Óз½·¨µÄ²ÎÊý£¬ÒòΪ²»¹ÜÊÇ·ñÆôÓÃÁ˶ÏÑÔ£¬¹«Óз½·¨¶¼±ØÐë¼ì²éÆä²ÎÊý¡£²»¹ý£¬¼È¿ÉÒÔÔÚ¹«Óз½·¨ÖУ¬Ò²¿ÉÒÔÔڷǹ«Óз½·¨ÖÐÀûÓöÏÑÔ²âÊÔºóÖÃÌõ¼þ¡£ÁíÍ⣬¶ÏÑÔ²»Ó¦¸ÃÒÔÈκη½Ê½¸Ä±ä³ÌÐòµÄ״̬¡£
assert() º¯ÊýÓ÷¨
assertºêµÄÔÐͶ¨ÒåÔÚ<assert.h>ÖУ¬Æä×÷ÓÃÊÇÈç¹ûËüµÄÌõ¼þ·µ»Ø´íÎó£¬ÔòÖÕÖ¹³ÌÐòÖ´ÐУ¬ÔÐͶ¨Ò壺
#include <assert.h>
void assert( int expression );
ass
Ïà¹ØÎĵµ£º
The meaning of each is:
MemberMeaningRange
tm_sec
seconds after the minute
0-61*
tm_min
minutes after the hour
0-59
tm_hour
hours since midnight
0-23
tm_mday
day of the month
1-31
tm_mon
months since January
0-11
tm_year
years since 1900
tm_wday
days since Sunday
0-6
tm_yday
d ......
C/C++ÕÐƸµÄһЩ¸ÐÊܺ;Ñé
Ç°¶Îʱ¼ä¸Õ²Î¼ÓÁËn¶à¹«Ë¾µÄC/C++Èí¼þ¹¤³ÌʦµÄÃæÊÔ£¬ÓйúÆó£¬ÍâÆó£¬Ë½Æó£¨moto£¬·É˼¿¨¶û£¬¸ÛÍ壬ÖйúÎÀÐÇXXX£¨Õâ¸öÅ££©£©µÈµÈµÈµÈ¡£¸ÐÊܸÐÏëÆĶ࣬½üÈÕÖÕÓÚ¿ÕÏУ¬Ôڴ˱íÊöһϡ£
±¾ÈË»ù±¾Ìõ¼þ£º3Ä꿪·¢¾Ñ飬2year+ Windows development experence£¬1year+ Linux experence. ÊìϤC£¬C++£¬MFC/ ......
bcmp
ÔÐÍ£ºextern int bcmp(const void *s1, const void *s2, int n);
Ó÷¨£º#include <string.h>
¹¦ÄÜ£º±È½Ï×Ö·û´®s1ºÍs2µÄÇ°n¸ö×Ö½ÚÊÇ·ñÏàµÈ
˵Ã÷£ºÈç¹ûs1=s2»òn=0Ôò·µ»ØÁ㣬·ñÔò·µ»Ø·ÇÁãÖµ¡£bcmp²»¼ì²éNULL¡£
bcopy
ÔÐÍ£ºextern void bcopy(const void *src, void *dest, int n);
Ó÷ ......
Ç°¶Îʱ¼ä¸Õ²Î¼ÓÁËn¶à¹«Ë¾µÄC/C++Èí¼þ¹¤³ÌʦµÄÃæÊÔ£¬ÓйúÆó£¬ÍâÆó£¬Ë½Æó£¨moto£¬·É˼¿¨¶û£¬¸ÛÍ壬ÖйúÎÀÐÇXXX£¨Õâ¸öÅ££©£©µÈµÈµÈµÈ¡£¸ÐÊܸÐÏëÆĶ࣬½üÈÕÖÕÓÚ¿ÕÏУ¬Ôڴ˱íÊöһϡ£
±¾ÈË»ù±¾Ìõ¼þ£º3Ä꿪·¢¾Ñ飬2year+ Windows development experence£¬1year+ Linux experence. ÊìϤC£¬C++£¬MFC/SDK/API,MiniG ......