"Thomas Lumley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, 18 Oct 2005, Earl F. Glynn wrote: > > > Whis is there a .Machine$sizeof.longdouble but no .Machine$sizeof.double? > > > > sizeof(double) is always 8 and sizeof(int) is always 4, because R requires > the IEEE/IEC standard arithmetic types. R will not compile with any other > sizes.
But it's a common, recommended software engineering practice to define mnemonic, named constants. If I were to see code like .Machine$sizeof.double * N.COL * N.ROW, I know that's the number of bytes in a matrix of doubles. If I see code that is 8 * N.COL * N.ROW, I can guess what "8" means, but I could guess wrong. I wrote code that looks just like this today because I couldn't find the defined constant. Will someone else reading my code automatically know what the "8" means? The use of literal constants should be discouraged. I encourage more to study Section 12.7 "Named Constants" in the book "Code Complete 2" (see http://www.cc2e.com/). At some point the R community should become more receptive to named constant to make R code more readable and easier to maintain. But for now, I guess I still have a minority opinion on this matter in the R community. efg ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel