Author: Omid David Tabibi
Date: 23:58:51 07/28/03
Go up one level in this thread
On July 29, 2003 at 01:54:29, Gerd Isenberg wrote: >On July 28, 2003 at 19:00:41, Dieter Buerssner wrote: > >>On July 28, 2003 at 18:26:29, Gerd Isenberg wrote: >> >>>References, function inlining and namespaces are enaugh to use C++. >> >>Gerd, references is enough for me, to avoid C++. In the "old days", when I read >>code with a function call, like foo(a), I was sure, that a will be the same >>after the function call, than before. With C++, I cannot be sure anymore. If I >>want to make a changable by a function call, I use &a in C. All pretty much self >>documenting. Not anymore in C++. > >Hi Dieter, > >i see your point - i have no problems with references, may be due to Java. >References are very intuitive for me, but i don't use them "randomly" in >functions. >Most often the "output" paramter by reference is the first (left) one - and i >use appropriate function identifiers, implying the desired side effect. > > int bitScanAndReset(BitBoard &bb); > void assignWithMask(int &target, int source, int mask); > > >> >>It may even be a performance issue. I read your suggestion about the small >>inline functions vs. macros. I basically agree. But when using reference >>paramaters (your example did), things might be very different. This might make >>it very difficult or even impossible to make a good optimization for the >>compiler. > >I never found a problem so far. I guess from compilers point of view, there is >no pragmatical difference between a pointer and a reference. I think there is no difference at all between the way pointer and reference work. I compared the assembly generated for a number of functions in both by reference and by pointer versions, there was no difference at all, both in Debug mode and Release mode. > >Regards, >Gerd > >> >>Function inlining is part of the ISO C Standard of 1999. Not all compilers >>support it. >> >>Regards, >>Dieter
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.