On Tue, Dec 16, 2014 at 10:29 PM, Warren Young <w...@etr-usa.com> wrote: > > On Dec 16, 2014, at 7:37 PM, Richard Hipp <d...@sqlite.org> wrote: > > > But they are useful at times. > > Yes. It’s not as useful as a type system that simply doesn’t let you do > questionable things,[*] but when you have to write in C or C++, it’s good > to buttress the type system with some notation. > > I’ve used a similar system for decades: > > a = array (some like v for vector instead) > b = Boolean > c = character (except when used as an 8-bit integer) > e = enum > f = floating-point number > g = global > h = handle (haven’t used this since my Win32 days) > k = constant > n = integer number > p = pointer > s = string (C++ only; C strings are pc or kpc) > _ = trailing underscore on C++ private member variables >
The thing I dislike about the "strict Microsoft way" is the embedding of actual type data into the variable name, so that if you decide to change a type later, you have to change all the names. (I realize the above quote is not the "strict Microsoft way", just commenting). I like the idea of a loose Hungarian notation which helps you remember the general purpose of a variable (handle, string, number, pointer). I loathe ... uh ... do not care for ... the embedding of scope or constness. Which is not to say I never do it (when in Rome) but I still don't care for it. If source code is meant to be read by humans (as well as processed by compilers) then I want as little crypticness (is that a word) while reading as possible. The nature of programming prevents that from being achieved anywhere near 100% of the time, of course, but I prefer not to sound like I'm coughing up a furball if I'm discussing source out loud. :) > My actual function was fairly complex, and I accidentally left one of the > “return false” calls unchanged. C++ allows false to convert to 0 which > converts to const char* which turned a failure condition into success! The > compiler didn’t even blink, even with -Wall. Perfectly sane according to > GCC. Grrr. > Well, it's just a widening conversion of 0 from 1 bit to 32 or 64 bits. Of course it's sane! :) -- Scott Robison
_______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users