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
Ïà¹ØÎĵµ£º
ÄÚ´æ¿ØÖÆÆª
calloc
free
getpagesize
malloc
mmap
munmap
calloc£¨ÅäÖÃÄÚ´æ¿Õ¼ä£©
Ïà¹Øº¯Êý
malloc£¬free£¬realloc£¬brk
±íÍ·Îļþ
#include <stdlib.h>
¶¨Ò庯Êý
void *calloc(size_t nmemb£¬size_t size);
º¯Êý˵Ã÷
calloc()ÓÃÀ´ÅäÖÃnmemb¸öÏàÁÚµÄÄڴ浥λ£¬Ã¿Ò»µ¥Î»µÄ´óСΪsize£¬²¢·µ»ØÖ¸ÏòµÚ ......
´î½¨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++µÄ±àÒëÆ÷ºÍµ÷ÊÔÆ ......
1.
ÒýÑÔ
¡¡¡¡C++
ÓïÑԵĴ´½¨³õÖÔÊÇ“a
better C”
£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++
ÖÐÀàËÆC
ÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëC
ÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC
¼æÈݵÄÓïÑÔ£¬C++
±£ÁôÁËÒ»²¿·Ö¹ý³Ì ʽÓïÑÔµÄÌØµã£¨±»ÊÀÈ˳ÆÎª“
²»³¹µ×µØÃæÏò¶ÔÏó”
£©£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö ......
#include "mex.h"
#define DWORD long
#define NUMBER_OF_STRUCTS (sizeof(friends)/sizeof(struct phonebook))
#define NUMBER_OF_FIELDS (sizeof(field_names)/sizeof(*field_names))
void mexFunction(int nlhs,
mxArray * plhs[] , int nrhs,const mxArray * pahs[])
{
typedef struc ......