From: Ry Nohryb on 26 Apr 2010 17:58 On Apr 26, 9:34 pm, John G Harris <j...(a)nospam.demon.co.uk> wrote: > > Now read > <http://www2.research.att.com/~bs/blast.html> > (...) Nah, here's his most truly enlightening talk : http://artlung.com/smorgasborg/Invention_of_Cplusplus.shtml -- Jorge.
From: Stefan Weiss on 26 Apr 2010 18:10 On 26/04/10 23:58, Ry Nohryb wrote: > Nah, here's his most truly enlightening talk : > http://artlung.com/smorgasborg/Invention_of_Cplusplus.shtml ....and after reading that truly enlightening interview, it may be a good idea to read this: <http://www2.research.att.com/~bs/bs_faq.html#IEEE> -- stefan
From: Dmitry A. Soshnikov on 27 Apr 2010 05:10 On Apr 26, 7:06 pm, "Dmitry A. Soshnikov" <dmitry.soshni...(a)gmail.com> wrote: > Although, I don't know -- maybe it is even so at implementation > stage, I didn't read C++ specification. I checked in MS 2005 compiler. It is so, C++ reference concept *is just a syntactic sugar* for a pointer. I can statement it now precisely. Example to check: <URL: http://gist.github.com/380515> 1 C++ source: 2 3 void call_by_reference(int& x) 4 { 5 x = 20; 6 } 7 8 void call_by_pointer(int* x) 9 { 10 *x = 20; 11 } 12 13 void by_value(int x) 14 { 15 x = 20; 16 } 17 18 int _tmain(int argc, _TCHAR* argv[]) 19 { 20 int y = 0; 21 22 call_by_reference(y); 23 call_by_pointer(&y); 24 by_value(y); 25 26 return 0; 27 } 28 29 Disassembly: 30 31 The most important lines are 50-51 (by-reference) and 55-56 (by- pointer) 32 as we see, the same -- load effective address and push to stack. 33 34 int _tmain(int argc, _TCHAR* argv[]) 35 { 36 00F81480 push ebp 37 00F81481 mov ebp,esp 38 00F81483 sub esp,0CCh 39 00F81489 push ebx 40 00F8148A push esi 41 00F8148B push edi 42 00F8148C lea edi,[ebp-0CCh] 43 00F81492 mov ecx,33h 44 00F81497 mov eax,0CCCCCCCCh 45 00F8149C rep stos dword ptr es:[edi] 46 int y = 0; 47 00F8149E mov dword ptr [y],0 48 49 call_by_reference(y); 50 00F814A5 lea eax,[y] 51 00F814A8 push eax 52 00F814A9 call call_by_reference (0F81005h) 53 00F814AE add esp,4 54 call_by_pointer(&y); 55 00F814B1 lea eax,[y] 56 00F814B4 push eax 57 00F814B5 call call_by_pointer (0F8100Fh) 58 00F814BA add esp,4 59 by_value(y); 60 00F814BD mov eax,dword ptr [y] 61 00F814C0 push eax 62 00F814C1 call by_value (0F8100Ah) 63 00F814C6 add esp,4 64 65 return 0; 66 00F814C9 xor eax,eax 67 } P.S.: Also, C++ creator Straustrup also notice that at implementation level, a reference is just a sugar for the pointer. And this pointer is dereferenced every time when we deal with a reference operation. Dmitry.
From: Dmitry A. Soshnikov on 27 Apr 2010 05:11 On Apr 26, 11:42 pm, John G Harris <j...(a)nospam.demon.co.uk> wrote: > On Mon, 26 Apr 2010 at 08:06:32, in comp.lang.javascript, Dmitry A. > > Soshnikov wrote: > >On Apr 26, 6:28 pm, John G Harris <j...(a)nospam.demon.co.uk> wrote: > >> On Sun, 25 Apr 2010 at 11:25:31, in comp.lang.javascript, Dmitry A. > > >> Soshnikov wrote: > > >> <snip>>I repeat, regardless that reference-concept is just a > >> >sugar for the pointer in C++, > > >> <snip> > > >> That isn't true. In C++ a reference is a synonym. The compiler doesn't > >> have to use a pointer. If it's possible and if it wants to it can treat > >> it like a macro instead. (See 'frog', use 'jump'). > > >It doesn't matter. > > <snip> > > Spreading misinformation always matters. > Now who from us a two is spreading misinformation? I'm waiting. Dmitry.
From: Dmitry A. Soshnikov on 27 Apr 2010 05:27
On Apr 27, 1:10 pm, "Dmitry A. Soshnikov" <dmitry.soshni...(a)gmail.com> wrote: > I checked in MS 2005 compiler. Sorry, typo, even in 2008. Dmitry. |