📄 cross_cc.c
字号:
#include "cross_conf.h"#if defined( STD_HEADERS) || defined( HAVE_STDIO_H )#include <stdio.h>#endifstatic char* is_runtime_bigendian( void ){ union { long ll; char cc[sizeof(long)]; } uu; uu.ll = 1; if ( uu.cc[sizeof(long) - 1] == 1 ) return "true"; else return "false";}int main( int argc, char *argv[] ){ FILE *cross_file; cross_file = fopen( CROSS_SPEC_FILE, "a" ); if ( cross_file == NULL ) { fprintf( stderr, "Can't open %s for appending!\n", CROSS_SPEC_FILE ); return 1; } fprintf( cross_file, "%s\n", "# C compiler runtime characteristics..." ); fprintf( cross_file, "CROSS_SIZEOF_CHAR=%d\n", sizeof(char) ); fprintf( cross_file, "CROSS_SIZEOF_SHORT=%d\n", sizeof(short) ); fprintf( cross_file, "CROSS_SIZEOF_INT=%d\n", sizeof(int) ); fprintf( cross_file, "CROSS_SIZEOF_LONG=%d\n", sizeof(long) ); fprintf( cross_file, "CROSS_SIZEOF_LONG_LONG=%d\n", sizeof(long long) ); fprintf( cross_file, "CROSS_SIZEOF_VOID_P=%d\n", sizeof(void *) ); fprintf( cross_file, "CROSS_BIGENDIAN=%s\n", is_runtime_bigendian() ); fclose( cross_file ); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -