cÁ´±íʾÀý
CºêʵÀý
Õª×ÔLinuxÄÚºË2.6.21.5Ô´Âë(²¿·Ö)£¬Õ¹Ê¾ÁËÁ´±íµÄÁíÒ»ÖÖʵÏÖ˼·
δ²ÉÓÃANSI C±ê×¼£¬²ÉÓÃGNU C±ê×¼£¬×ñ´ÓGPL°æȨÐí¿É¡£
struct list_head {
struct list_head *next, *prev;
};
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
static inline void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}
static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
static inline void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
static inline void __list_del(struct list_head * prev, struct list_head * next)
{
next->prev = prev;
prev->next = next;
}
static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = NULL;
entry->prev = NULL;
}
#define __list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
prefetch(pos->member.next), &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
c´úÂëʵÀý
·¶Àý´úÂëÊÇË«Ïò»·ÐÎÁ´±íµÄ»ù±¾²Ù×÷²¿·ÖµÄʵÀý£¨Î´°üº¬Ḭ̈߳²È«»úÖÆ£©È«²¿×ñ´ÓANSI C±ê×¼
//½Ó¿ÚÉùÃ÷
#ifndef LLIST_H
#define LLIST_H
typedef void node_proc_fun_t(void*);
typedef int node_comp_fun_t(const void*, const void*);
typedef void LLIST_T;
LLIST_T *llist_new(int elmsize);
int llist_delete(LLIST_T*);
int l
Ïà¹ØÎĵµ£º
´î½¨eclipse C/C++¿ª·¢»·¾³£º
1¡¢ÏÂÔز¢°²×°Eclipse for C++£ºhttp://www.eclipse.org¡£×îаæÊÇ»ùÓÚEclipse 3.5 galileo£¬ÎļþÃûΪeclipse-cpp-galileo-SR1-win32.zip¡£É蹤×÷Ŀ¼ΪD:\workspace_cpp¡£
2¡¢eclipse for C/C++ IDEûÓаüº¬C/C++µÄ±àÒëÆ÷ºÍµ÷ÊÔÆ ......
/*
* 2010-1-21
* ¸ÃÎļþʱÄÚºËÖÐÓйØÈÎÎñµ÷¶ÈµÄº¯Êý³ÌÐò£¬ÆäÖаüº¬»ù±¾º¯Êýsleep_on£¬
* wakeup£¬scheduleµÈ£¬ÒÔ¼°Ò»Ð©¼òµ¥µÄϵͳµ÷Óá£Í¬Ê±½«ÈíÅ̵ļ¸¸ö²Ù×÷
* º¯ÊýÒ²·ÅÖÃÔÚÕâÀï¡£
*
* scheduleº¯ÊýÊ×ÏȶÔËùÓеÄÈÎÎñ¼ì²é£¬»½ÐÑÈκÎÒ»¸öÒѾµÃµ½ÐźŵÄÈÎÎñ£¬
* ......
C×Ö·û´®´¦Àíº¯ÊýµÄʵÏÖ£¨Linux£©
#include <stddef.h>
char * ___strtok = NULL;
char * strcpy(char * dest,const char *src)
{
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
char * strncpy(char * des ......
LinuxÏÂCºÍC++¿ª·¢»ù´¡
»ù±¾±à³Ì¸ÅÄî
n ±à³ÌÓïÑÔ£ºC ¡¢C++
n ±àÒë(compile)£ºÔ´Îļþ£¨.c£©->Ä¿±êÎļþ(.o)
n Á¬½Ó(link)£ºÄ¿±êÎļþ(.o)->¿ÉÖ´ÐÐÎļþ
n ¿â(library)£º¾²Ì¬Á¬½Ó¿â(.a)¡¢¶¯Ì¬Á¬½Ó¿â(.so)
LinuxÏ¿ª·¢¹¤¾ß
n±à¼Æ÷£ºvi¡¢emacs¡¢´°¿Ú±à¼Æ÷
n±àÒëÆ÷£ºGCC
nµ÷ÊÔÆ÷£ºGDB
n¿ÉÖ´ÐÐÎļþ¹¤¾ß£ ......
¶¨ÒåÒ»¸ö×Ö·ûÖ¸Õ룬Æä±¾ÖʵĴ¦Àí·½Ê½ÊÇ°´×Ö·ûÊý×é´¦ÀíµÄ£¬ÔÚÄڴ濪±ÙÒ»¸ö×Ö·ûÊý×éÓÃÀ´´æ·Å×Ö·û´®³£Á¿£¬ÕâÑù±Ø¶¨»áÖÕÖ¹·û¡£¶øÕâÑùµÄÌØÐÔÒ²½ö¶ÔÓÚ×Ö·ûÖ¸Õë±äÁ¿¡£
ÔÚCÓïÑÔÖУ¬Í¨¹ýÊý×éÃû»òÕßÖ¸Õë±äÁ¿Êä³öÒ»¸ö×Ö·û´®£¬ÎÒÀí½âΪÁ½¸ö£º×Ö·û´®ÖÕÖ¹·ûµÄ´æÔÚ£»ÒÔ%s¸ñʽµÄÊä³ö·½Ê½¡£
char *p="I love china!";
& ......