int main(void) { struct scalar_01 *sc0, *sc1; mnbytestream_t bs0, bs1; mnbytes_t *s; ssize_t sz; sc0 = scalar_01_new(); assert(sc0 != NULL); sc1 = scalar_01_new(); assert(sc1 != NULL); sc0->id = 123; sc0->name = &_foo; BYTES_INCREF(sc0->name); sc0->weight = 234; sc0->impression = EXCELLENT; (void)bytestream_init(&bs0, 32); sz = scalar_01_pack(&bs0, sc0); D8(SPDATA(&bs0), SEOD(&bs0)); TRACE("sz=%zd", sz); s = bytes_new_from_mem_len(SPDATA(&bs0), SEOD(&bs0)); bytestream_from_bytes(&bs1, s); SEOD(&bs1) = BSZ(s); //D8(BDATA(s), BSZ(s)); sz = scalar_01_unpack(&bs1, NULL, sc1); TRACE("sz=%zd", sz); bytestream_rewind(&bs0); sz = scalar_01_dump(&bs0, sc0); //D8(SPDATA(&bs0), SEOD(&bs0)); TRACE("dump: %s", SPDATA(&bs0)); bytestream_rewind(&bs0); sz = scalar_01_dump(&bs0, sc1); //D8(SPDATA(&bs0), SEOD(&bs0)); TRACE("dump: %s", SPDATA(&bs0)); scalar_01_destroy(&sc0); assert(sc0 == NULL); scalar_01_destroy(&sc1); assert(sc1 == NULL); bytestream_fini(&bs0); //bytestream_fini(&bs1); BYTES_DECREF(&s); BYTES_NREF_STATIC_INVARIANT(_foo); return 0; }
int main () { #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 if (Check<B1, C1> ()) return 1; if (Check<B2, C2> ()) return 2; if (Check<B3, C3> ()) return 3; if (Check<B4, C4> ()) return 4; if (Check<B5, C5> ()) return 5; if (Check<B6, C6> ()) return 6; if (Check<B7, C7> ()) return 7; if (Check<B8, C8> ()) return 8; if (Check<C1> (D1 ())) return 11; if (Check<C2> (D2 ())) return 12; if (Check<C3> (D3 ())) return 13; if (Check<C4> (D4 ())) return 14; if (Check<C5> (D5 ())) return 15; if (Check<C6> (D6 ())) return 16; if (Check<C7> (D7 ())) return 17; if (Check<C8> (D8 ())) return 18; if (sizeof (C2) == nearly_empty_size) return 22; if (sizeof (C3) == nearly_empty_size) return 23; if (sizeof (C4) == nearly_empty_size) return 24; if (sizeof (C5) == nearly_empty_size) return 25; if (sizeof (C6) == nearly_empty_size) return 26; if (sizeof (C7) == nearly_empty_size) return 27; if (sizeof (C8) == nearly_empty_size) return 28; #endif return 0; }