_STD_BEGIN // DEQUE PARAMETERS#define _DEQUEMAPSIZ 8 /* minimum map size, at least 1 */#define _DEQUESIZ (sizeof (_Ty) <= 1 ? 16 \ : sizeof (_Ty) <= 2 ? 8 \ : sizeof (_Ty) <= 4 ? 4 \ : sizeof (_Ty) <= 8 ? 2 : 1) /* elements per block (a power of 2) */
C++ (Qt)deque <int> test1; // 4 элемента в блоке (ой не густо) struct Foo { double m[3];};deque <Foo> test1; // а так аж один :-(
C++ (Qt)int * p = &vec[0];
C++ (Qt)#include <iostream> int main( int, char ** ){ char *buf1 = new char [ 40961 ]; char *buf2 = new char [ 40961 ]; char *buf3 = new char [ 10 ]; std::cout << (void *)buf1 << " " << (int)buf1 << std::endl << (void *)buf2 << " " << (int)buf2 << std::endl << (void *)buf3 << " " << (int)buf3 << std::endl;}
g++ ex.cppexx.cpp: In function ‘int main(int, char**)’:exx.cpp:9: error: cast from ‘char*’ to ‘int’ loses precisionexx.cpp:10: error: cast from ‘char*’ to ‘int’ loses precisionexx.cpp:11: error: cast from ‘char*’ to ‘int’ loses precision
[xxx@zzz ~]$ cat ex.cpp#include <iostream>int main( int, char ** ){ int const d = 40961; char *buf1 = new char [ d ]; char *buf2 = new char [ d ]; char *buf3 = new char [ 10 ]; long b1 = (long) buf1; long b2 = (long) buf2; long b3 = (long) buf3; std::cout << (void *) buf1 << " " << b1 << " +" << b2 - (b1 + d) << std::endl << (void *) buf2 << " " << b2 << " +" << b3 - (b2 + d) << std::endl << (void *) buf3 << " " << b3 << std::endl;}[xxx@zzz ~]$ g++ ex.cpp[xxx@zzz ~]$ ./a.out 0x800d02000 34373378048 +40950x800d0d000 34373423104 +41590x800d18040 34373468224[xxx@zzz ~]$ g++ -vUsing built-in specs.Target: amd64-undermydesk-freebsdConfigured with: FreeBSD/amd64 system compilerThread model: posixgcc version 4.2.1 20070719 [FreeBSD][xxx@zzz ~]$