2008-03-25

3.141592653589793...

I joined the Pi day celebrations on 3-14 at AO's place. Obviously, this should have been 6-28 instead, because the important constant is 2pi. Who cares about diameters - the period of imaginary exponent is, of course, much more fundamental. This way it will also join the club of Physical Constants Starting With 6 (like G=6.67e-11N*m^2/kg^2, h=6.626e-34Js, ...).

DC: "Well, before you interfere in My domain, please take a moment to fix the sign of electric current."

(In fact, mathematically, chances for a real physical constant or value with arbitrary units start with 6 is not the same as to start with any other digit. For 1 it's much higher and for 9 it's much lower. It's easy to understand that. The constant's log is what should be uniformly distributed).

Changed my mind: reference params are better than pointer params

Confession: for long time, I've been thinking that C++ reference is a fancy and a completely stupid way of writing a pointer. A way useful only for two things. One is operator overloading when an lvalue is needed - i.e. where "&a += c" semantics is not an acceptable way of writing "a+=c". The second thing is to make it easier to cut-and-paste code across functions, so that a lazy programmer wouldn't have hard time adding all those stars. The truth is different: reference is a significantly different language tool than a pointer. A reference can never be invalid, at least unless forced to be so with a far less-trivial construct than what is needed to make a pointer invalid.

In the modern era of C++ references and boost::shared_ptr, pointers can really be confined to something that is "explicitly nullable" and where you need this nullability.

VZ: "But of course. Every * and -> is an access violation waiting to happen"