这篇教程C++ ARRLEN函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ARRLEN函数的典型用法代码示例。如果您正苦于以下问题:C++ ARRLEN函数的具体用法?C++ ARRLEN怎么用?C++ ARRLEN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ARRLEN函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: verifyDatabasebool MapDatabasePostgreSQL::saveBlock(const v3s16 &pos, const std::string &data){ // Verify if we don't overflow the platform integer with the mapblock size if (data.size() > INT_MAX) { errorstream << "Database_PostgreSQL::saveBlock: Data truncation! " << "data.size() over 0xFFFFFFFF (== " << data.size() << ")" << std::endl; return false; } verifyDatabase(); s32 x, y, z; x = htonl(pos.X); y = htonl(pos.Y); z = htonl(pos.Z); const void *args[] = { &x, &y, &z, data.c_str() }; const int argLen[] = { sizeof(x), sizeof(y), sizeof(z), (int)data.size() }; const int argFmt[] = { 1, 1, 1, 1 }; if (getPGVersion() < 90500) { execPrepared("write_block_update", ARRLEN(args), args, argLen, argFmt); execPrepared("write_block_insert", ARRLEN(args), args, argLen, argFmt); } else { execPrepared("write_block", ARRLEN(args), args, argLen, argFmt); } return true;}
开发者ID:Gael-de-Sailly,项目名称:minetest,代码行数:31,
示例2: teststatic void test(struct socket_server *ss) { pthread_t pid; pthread_create(&pid, NULL, _poll, ss); int i = 0; int connid = socket_server_connect(ss, 400, "127.0.0.1", 8888); getc(stdin); socket_server_start(ss, 401, connid); char* tmp[3] = { "hello", "world", "wong" }; int cnt = ARRLEN(tmp); char* contents[ARRLEN(tmp)]; for (i = 0; i < cnt; ++i) { contents[i] = malloc(strlen(tmp[i]) + 1); memcpy(contents[i], tmp[i], strlen(tmp[i])); } for (i = 0; i < cnt; ++i) { socket_server_send(ss, connid, contents[i], strlen(contents[i])); getc(stdin); } printf("done/n"); pthread_join(pid, NULL);}
开发者ID:wonghoifung,项目名称:tips,代码行数:29,
示例3: updateMemoryint updateMemory(void){#define ARRLEN(X) (sizeof(X) / sizeof(X[0])) long pagesize; /* using a long promotes the arithmetic */ size_t len; { static int mib[] = {CTL_HW, HW_PHYSMEM}; len = sizeof(Total); sysctl(mib, ARRLEN(mib), &Total, &len, NULL, 0); Total >>= 10; } { struct uvmexp x; static int mib[] = {CTL_VM, VM_UVMEXP}; len = sizeof(x); STotal = SUsed = SFree = -1; pagesize = 1; if(-1 < sysctl(mib, ARRLEN(mib), &x, &len, NULL, 0)) { pagesize = x.pagesize; STotal = (pagesize * x.swpages) >> 10; SUsed = (pagesize * x.swpginuse) >> 10; SFree = STotal - SUsed; } }
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:30,
示例4: test_nghttp2_hd_deflate_boundvoid test_nghttp2_hd_deflate_bound(void) { nghttp2_hd_deflater deflater; nghttp2_nv nva[] = {MAKE_NV(":method", "GET"), MAKE_NV("alpha", "bravo")}; nghttp2_bufs bufs; size_t bound, bound2; nghttp2_mem *mem; mem = nghttp2_mem_default(); frame_pack_bufs_init(&bufs); nghttp2_hd_deflate_init(&deflater, mem); bound = nghttp2_hd_deflate_bound(&deflater, nva, ARRLEN(nva)); CU_ASSERT(12 + 6 * 2 * 2 + nva[0].namelen + nva[0].valuelen + nva[1].namelen + nva[1].valuelen == bound); nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, ARRLEN(nva)); CU_ASSERT(bound > (size_t)nghttp2_bufs_len(&bufs)); bound2 = nghttp2_hd_deflate_bound(&deflater, nva, ARRLEN(nva)); CU_ASSERT(bound == bound2); nghttp2_bufs_free(&bufs); nghttp2_hd_deflate_free(&deflater);}
开发者ID:0xfffffff7,项目名称:nghttp2,代码行数:29,
|