LINUXÄÚºËÖÐminºÍmaxºêµÄѧϰ
add linux kernel min, max define:
include/linux/kernel.h
/*
* min()/max() macros that also do
* strict type-checking.. See the
* "unnecessary" pointer comparison.
*/
#define min(x,y) \
(__extension__\
({ \
typeof(x) _x = (x); \
typeof(y) _y = (y); \
(void) (&_x == &_y); \
_x < _y ? _x : _y; }) \
)
#define max(x,y) \
(__extension__\
({ \
typeof(x) _x = (x); \
typeof(y) _y = (y); \
(void) (&_x == &_y); \
_x > _y ? _x : _y; }) \
)
ÈçÉÏÊÇinclude/linux/kernel.hÖйØÓÚminºÍmaxÁ½¸öºÜ³£ÓõĺêµÄ¶¨Ò壬ÔÚÆäÖÐÎÒÃÇ¿ÉÒÔ¿´µ½ÒÔϼ¸¸ö¹Ø¼üµã£º
1. ΪºÎ²»Óøü¼òµ¥µÄ(x>y)?x:y ÕâÑùµÄ·½Ê½À´¶¨Ò壬¶øÒªÖØи³ÖµÒ»´Î¡£
2. ΪºÎÒªÓÃ({ })ÕâÑùµÄ½á¹¹°üΧ´úÂë¿é
3. ÄǸö__extension__ÊÇʲô¶«¶«£¿ £¨Óеİ汾ûÓÐÕâ¸ö__extension__)
4. (void)(&_x == &_y)ÓÐʲôÓ㬲»ÊÇÍÑÁË¿ã×Ó·Åƨô
½â´ð£º
1. Èç¹ûÓû§Ê¹ÓÃÁËmin(x++,y++)»áÓÐÔõÑùµÄ½á¹û£¿
ËùÒÔ×îºÃµÄ°ì·¨ÊDZÜÃâÔÚºêµÄʵÌåÀïÈòÎÊý³öÏÖÒ»´ÎÒÔÉÏ¡£ÀϵÄlinuxÓõÄÊÇ x>?y£¬Õâ¸ö>?²Ù×÷·ûÊÇ·µ»ØxºÍyÖнϴóµÄÒ»¸ö£¬²»¹ýGCCµÄÎĵµÀïÒѾ¾ö¶¨Å×ÆúÕâÖÖÀϵÄÓ÷¨ÁË¡£
2. GCCµÄÀ©Õ¹ÀïÏñ{ }ÕâÖֽṹҲÊÇ¿ÉÒÔÓÐÖµµÄ£¬ÆäÖµ¾ÍÊÇÆäÖÐ×îºóÒ»¸öÓï¾äµÄÖµ£¨°üÀ¨×óÖµ£©£¬ÕâÀïÍâÃæÔÙ¼Ó¸öÀ¨ºÅÊÇΪÁ˱£ÏÕ£¬±ÈÈ磺
printf("²Â²Â»áÏÔʾʲô£¿\n´ð°¸ÊÇ:%d\n",({
&
Ïà¹ØÎĵµ£º
//»ñÈ¡±¾»úIPµØÖ·º¯Êý
QString GetLocalIp()
{
int sock_get_ip;
char ipaddr[50];
struct sockaddr_in *sin;
struct ifreq ifr_ip;
if ((sock_get_ip=socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
printf("socket create failse...GetLocalIp!\n");
return ""; ......
//»ñÈ¡±¾»úMACµØÖ·º¯ÊýQString GetLocalMac()
{
int sock_mac;
struct ifreq ifr_mac;
char mac_addr[30];
sock_mac = socket( AF_INET, SOCK_STREAM, 0 );
if( sock_mac == -1)
{
perror("create socket falise...mac\n");
return "";
}
memset(&ifr_mac,0,sizeof(ifr_mac));
......
1. ÏÂÔØLinuxÏÂDNWµÄPC¶ËUSBÇý¶¯ºÍдÈ빤¾ß
ÏÂÔصØÖ·£ºÒÑÉÏ´«ÖÁCSDN
2. ±àÒëPC¶ËUSBÇý¶¯ºÍдÈ빤¾ß
2.1 ½âѹËõ
$ tar xzvf /path/to/dnw_linux.tgz
dnw_linux/
dnw_linux/secbulk/
dnw_linux/secbulk/Makefile
dnw_linux/secbulk/secbulk.c
dnw_linux/dnw/
dnw_linux/dnw/dnw.c
......
µ±ÎÒÃǵijÌÐò±ÀÀ£Ê±£¬ÄÚºËÓпÉÄܰѸóÌÐòµ±Ç°ÄÚ´æÓ³Éäµ½coreÎļþÀ·½±ã³ÌÐòÔ±ÕÒµ½³ÌÐò³öÏÖÎÊÌâµÄµØ·½¡£×î³£³öÏֵģ¬¼¸ºõËùÓÐC³ÌÐòÔ±¶¼³öÏÖ¹ýµÄ´íÎó¾ÍÊÇ“¶Î´íÎó”ÁË¡£Ò²ÊÇ×îÄѲé³öÎÊÌâÔÒòµÄÒ»¸ö´íÎó¡£ÏÂÃæÎÒÃǾÍÕë¶Ô“¶Î´íÎó”À´·ÖÎöcoreÎļþµÄ²úÉú¡¢ÒÔ¼°ÎÒÃÇÈçºÎÀûÓÃcoreÎļþÕÒµ½³öÏÖ±ÀÀ£µÄµØ·½¡ ......
ÔÎÄ£ºhttp://developer.51cto.com/art/200907/134477.htm
JDK1.6ÔÚLINUXϵݲװÅäÖÃÊÇJava³õѧÕß¿ªÊ¼Java±à³ÌµÄ
±Ø¾Ö®Â·£¬ÄÇôÈçºÎJDK1.6ÔÚLINUXϵݲװÅäÖþͳÉÁËÊ×ÒªµÄÎÊÌ⣬ÄÇô±¾ÎľÍÏòÄã½éÉÜJDK1.6ÔÚLINUXϵݲװÅäÖÃÎÊÌâ¡£
JDK1.6ÔÚLINUXϵݲװÊÇÈçºÎ½øÐеÄÄØ£¬ÈÃÎÒÃÇ¿ªÊ¼ÎÒÃǵÄÑÝʾ£º
Ubuntu LinuxÏÂjdkµ ......