Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
The return value is formatted with the general numeric format specifier ("G") and the NumberFormatInfo object for the current culture.
In this case, though, this is not what was going on. None of the rest of the code is trying to be localized AT ALL. This was just someone getting an error about 1 not being a string, and so making it a string.
Here's some Perl code I came across while researching the BFLT executable file format:

   # Pack/unpack template for the BFLT header, 4 bytes ACSII,
   # 15 little-endian words
   my $hdrFmt = 'a4 N15';

   my @unpHdr = unpack $hdrFmt, $hdr;

This comes from a tool named gunzip_bflt.pl. What's wrong with it? For non Perl speakers, the comment is wrong. The template "a4 N15" unpacks 4-byte binary data, not "ACSII" (sic) data (a4), for 15 unsigned big-endian longs, not little-endian words (N15). Granted, "word" could mean either long (32 bit) or short (16 bit) depending on architecture, but I still say it's wrong because it's vague. The template as given is correct, by the way*.

I have only three possible explanations for this utterly incorrect comment:
  1. Someone other than the code's author wrote the comment
  2. The author is trying to be funny by inserting misleading comments in the code (ha ha?)
  3. The author is an idiot

Take your pick. Razz

* I'm not 100% sure yet whether the fields in a BFLT header can be little-endian (host byte order) for some systems, or if BFLT is defined to be only big-endian. If the former is true, then this program will fail for BFLT files created for little-endian machines (eg, x86), but if the latter is true, it will work for BFLT's made for any machine. Incidentally, I will be using this format for a big-endian CPU (the 68k), so I don't have to worry about any breakage here. Smile
I'm kind of late to the game to comment on this one (only by a year or so), but I don't get why you people were arguing so much over this one:

if (!Page.IsPostBack)

It's just as clear written as one line:

There's no ternary operators, so I don't see the point of even mentioning nested ternary operators in the first place.

Speaking of ternary operators, I recently came across many lines in several different source files following this pattern:

boolean x = (y == z) ? true : false;
boolean x = (y == z) ? false : true;

Like, wtf, mate? Thankfully, the guy who wrote this and other crap code is no longer with the company.
heh, nice use of teneraries Razz
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 6 of 6
» All times are GMT - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum