lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Some miscellaneous ramblings about the list's meanderings over the
last week or so:

1. WELL, by setting my terminal's font point size to 1.5, I managed
to get a terminal width over 1000 characters!!!  SO THERE!!! (Pity
that I can't read any of the text.);

2. I abhor Hungarian notation, but I use CamelCase for identifiers,
and I've adopted one snippet that relates to the "give pointers
their own type"... I don't do that, but do this instead (somewhat
influenced by the "declaration mimics use" ethos that was used
when typeless "B" became typed "C" all those years ago):

        int Width;
        int *pWidth;
        int **ppWidth;

Using the "p" prefix, balancing the level of indirection, leads to
code like:

        Width = *pWidth;
        ppWidth = &pWidth;

3. I agree with 8-column indentation, using strictly spaces as a
canonical representation, as this fits in with content-based
version control systems such as Git with strict whitespace
controls enabled.  I strongly agree with the fact that such a
wide step quickly makes you run out of space, especially with an
80-column limit, and that, as the mind's limit to handle nested
concepts/abstractions is limited, a lot of indentation is a very
strong signal that the code is becoming too complex to be easily
understood, and that refactoring/other reworking is worthwhile;

4. I've adopted "?? " as a general-purpose TODO: or REVIEWME:
marker:  It is a trigraph, which most people don't like, but the
space after the question marks makes it harmless.  Some people may
dislike it for another reason:  The question mark meta-character
is often an integral part of pattern matching (e.g. regular
expressions in various incarnations).  This is valid, but sadly,
it's too ingrained in my style for me to abandon it now; and

5. I've adopted a shorthand for "Number" suggested by one of the
most influential coders+hardware designers that I encountered
during my younger days:  Use the slightly-Germanic-style "Nr" as
a contracted version, prefix or postfix, for "Number", "Num",
etc, e.g.

	unsigned NrPrimes;
	unsigned Candidate;

        /* ?? A sanity check on Limit versus "unsigned" type
           would be appropriate here, but left out for brevity.  */

        /* Count how many primes are in the range [2..Limit], as
           this gives us a baseline for the main algorithm.  */
        NrPrimes = 0;

        /* Treat 2 separately, as it is the only even prime; this
           reduces the candidates we need to test in the main loop
           below.  */
        if (Limit >= 2) {

        /* Look for more primes in the range [3..Limit].  */
        for (Candidate = 3; Candidate <= Limit; Candidate += 2) {
                if (IsPrime(Candidate)) {

        printf("NrPrimes: %u\n", NrPrimes);


programmer, Grouse Software