// From http://stroustrup.com/bs_faq2.htmlinta=7;double*p1=(double*)&a;// ok (but a is not a double)double*p2=static_cast<double*>(&a);// errordouble*p2=reinterpret_cast<double*>(&a);// ok: I really mean itconstintc=7;int*q1=&c;// errorint*q2=(int*)&c;// ok (but *q2=2; is still invalid code and may fail)int*q3=static_cast<int*>(&c);// error: static_cast doesn't cast away constint*q4=const_cast<int*>(&c);// I really mean it
I don’t remember any deep thoughts or involved discussions about the order at the time. A few of the early users - notably me - simply liked the look of {cpp} const int c = 10; {/cpp} better than {cpp} int const c = 10; {/cpp} at the time.
1234567891011121314151617
# From http://docs.python.org/py3k/tutorial/stdlib2.htmlimportstructdata=open('myfile.zip','rb').read()start=0foriinrange(3):# show the first 3 file headersstart+=14fields=struct.unpack('<IIIHH',data[start:start+16])crc32,comp_size,uncomp_size,filenamesize,extra_size=fieldsstart+=16filename=data[start:start+filenamesize]start+=filenamesizeextra=data[start:start+extra_size]print(filename,hex(crc32),comp_size,uncomp_size)start+=extra_size+comp_size# skip to the next header
1234567891011
#include <iostream>usingnamespacestd;intmain(){staticintarr[100];intc;// This is a special varcout<<"Input a index";cin>>c;cout<<arr[c]<<endl;// arr[c] is special, too!}