This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** CMDLINE.C - Demonstrates accessing command line arguments | |
*/ | |
#include <stdio.h> | |
/// "string"[index] 不常见的用法 | |
#define plural_text(n) &"s"[(1 == (n))] | |
#define plural_text2(n) &"es"[(1 == (n)) << 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
struct s1 | |
{ | |
int a; | |
int b; | |
double c; | |
}; | |
struct s2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 参考: | |
# * http://blog.csdn.net/cherylnatsu/article/details/5878913 | |
# * http://www.termsys.demon.co.uk/vtansi.htm | |
# 颜色定义 | |
export GREEN=\033[32m | |
export RED=\033[31m | |
# 效果定义 | |
export BRIGHT=\033[1m | |
export Underscore=\033[4m | |
export REVERSE=\033[7m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 隐含规则使用的编译器,一般编译时候显式的也使用这个,如下面的$(CC) | |
CC=gcc | |
#隐含规则使用的预处理选项 | |
CPPFLAGS= -I.. | |
#隐含规则使用的编译(complie)器选项 | |
CFLAGS=-Wall -g | |
#连接器选项,不是隐含的,需要显式指出 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
PREFIX=$PWD | |
SRC=opt.c | |
EXE=a.out | |
.PHONY: all install clean distclean dist | |
all: | |
$(CC) $(SRC) -o $(EXE) | |
install: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 参考来源 :http://www.jiangmiao.org/blog/1285.html | |
#大致流程 | |
# po目录 | |
PO=po | |
LANGDIR=languages | |
# 翻译的语言的代码 | |
LG=zh_CN | |
######## 一. 简单整合命令 ######### | |
all:build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY:all staticlib main clean | |
all: staticlib main | |
staticlib: | |
gcc -c staticlib.c -o staticlib.o | |
ar -r staticlib.a staticlib.o | |
main: | |
gcc main.c staticlib.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
all: | |
$(CC) uart.c -o uart_app -Wall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <stdio.h> | |
#import <pthread.h> | |
void *threadFunction(void *arg) { | |
// To be executed when called... | |
} | |
int main(void) { | |
pthread_t *thread; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From JSON | |
var jsObject = JSON.parse(jsonString); | |
// To JSON | |
var jsonString = JSON.stringify(foo); |
NewerOlder