資源簡介
The book `C Interfaces and Implementations' by David Hanson
ftp://ftp.cs.princeton.edu/pub/packages/cii/

代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
/*
On?most?platforms?malloc?returns?pointers?to?blocks?that?are
aligned?on?addresses?that?are?multiples?of?the?size?of?the?largest
basic?data?type.?Some?CII?functions?use?a?union?to?determine?this
multiple?(cf.?union?align?on?p.?80).?Alignments?are?less?restrictive
on?some?platforms?and?for?these?MAXALIGN?must?be?defined?as?the
alignment?required.
This?program?attempts?to?determine?the?correct?value?for?MAXALIGN?if
one?is?necessary?and?echo?the?appropriate?-D?option.?Unfortunately
the?method?used?relies?on?the?C?compiler?using?the?same?alignments?as
malloc?which?is?not?required.?malloc?is?the?final?authority:?If?it
returns?addresses?that?are?multiples?of?sizeof?(union?align)?then
MAXALIGN?is?unnecessary;?otherwise?MAXALIGN?must?provide?the
alignment.?Incorrect?values?of?MAXALIGN?can?cause?crashes?and
assertion?failures.
*/
union?align?{
int?i;
long?l;
long?*lp;
void?*p;
void?(*fp)(void);
float?f;
double?d;
long?double?ld;
};
typedef?void?(*functp);
#define?yy?\
xx(inti);\
xx(longl);\
xx(long?*lp);\
xx(void?*p);\
xx(functpfp);\
xx(floatf);\
xx(doubled);\
xx(long?doubleld);
int?main(int?argc?char?*argv[])?{
#define?xx(tv) struct?{?char?pad;?t?v;?}?v
yy
#undef?xx
unsigned?max?=?0;
#define?xx(tv)?if?((char?*)&v.v?-?&v.pad?>?max)?max?=?(char?*)&v.v?-?&v.pad
yy
#undef?yy
if?(argc?>?1?&&?strcmp(argv[1]?“-v“)?==?0)
fprintf(stderr?“sizeof?(union?align)?=?%u\n“?sizeof?(union?align));
assert(max);
if?(max?!=?sizeof?(union?align))
printf(“-DMAXALIGN=%u\n“?max);
return?EXIT_SUCCESS;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-11-27?00:08??《C語言接口與實現》書中源代碼\
?????文件????????1943??2016-11-26?23:59??《C語言接口與實現》書中源代碼\README.txt
?????文件???????90233??2016-11-27?00:00??《C語言接口與實現》書中源代碼\cii11.tar.Z
?????文件???????52190??2016-11-27?00:00??《C語言接口與實現》書中源代碼\cii11.tar.gz
?????文件???????77587??2016-11-27?00:01??《C語言接口與實現》書中源代碼\cii11.zip
?????目錄???????????0??2016-11-27?00:06??《C語言接口與實現》書中源代碼\contrib\
?????文件????????1983??2016-11-27?00:03??《C語言接口與實現》書中源代碼\contrib\README.txt
?????文件????????9496??2016-11-27?00:06??《C語言接口與實現》書中源代碼\contrib\cii-lcc-win32.zip
?????文件???????29140??2016-11-27?00:03??《C語言接口與實現》書中源代碼\contrib\cii10-nt.zip
?????文件????????1713??2016-11-27?00:04??《C語言接口與實現》書中源代碼\contrib\maxalign.c
?????文件????????2547??2016-11-27?00:05??《C語言接口與實現》書中源代碼\contrib\thread.linux86
?????目錄???????????0??2016-11-27?00:10??《C語言接口與實現》書中源代碼\old\
?????文件???????63501??2016-11-27?00:08??《C語言接口與實現》書中源代碼\old\cii09b2.tar.Z
?????文件???????37586??2016-11-27?00:08??《C語言接口與實現》書中源代碼\old\cii09b2.tar.gz
?????文件???????54235??2016-11-27?00:08??《C語言接口與實現》書中源代碼\old\cii09b2.zip
?????文件???????72769??2016-11-27?00:09??《C語言接口與實現》書中源代碼\old\cii09b3.tar.Z
?????文件???????43477??2016-11-27?00:09??《C語言接口與實現》書中源代碼\old\cii09b3.tar.gz
?????文件???????66704??2016-11-27?00:09??《C語言接口與實現》書中源代碼\old\cii09b3.zip
?????文件???????74579??2016-11-27?00:09??《C語言接口與實現》書中源代碼\old\cii10.tar.Z
?????文件???????44850??2016-11-27?00:09??《C語言接口與實現》書中源代碼\old\cii10.tar.gz
?????文件???????68171??2016-11-27?00:10??《C語言接口與實現》書中源代碼\old\cii10.zip
- 上一篇:學生選課管理系統C語言
- 下一篇:yuv422與yuv420互轉
評論
共有 條評論