• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Static decimal members"

Collapse

  • NickFitz
    replied
    Forth (FORTH if you prefer) used to define 0, 1, 2, -1 and -2 as constants - it could be a win for an indirect-threaded implementation running on something like a 6809 or a Z80.

    Of course, there was nothing to stop you redefining them:

    Code:
    : 0 ( - n) ." Hello World" 3 ;
    
    : 1 ( - n) CAKE BAKE  42 ;
    
    : -1 ( - n)  R> DROP [ BASE @ DECIMAL 36 BASE ! ] FAIL [ BASE ! ] ;

    Leave a comment:


  • thunderlizard
    replied
    You think so? That is as plausible as anything I suppose. But something tells me that the people worried about the performance of their 1's aren't using .NET in the first place.

    Leave a comment:


  • Diestl
    replied
    So they can at a later date put a better optimized 1 in place and you wont have to change your code.

    Leave a comment:


  • thunderlizard
    replied
    I know, I've been using "magic numbers" all this time and am heartily sorry!

    From here on in, it's going to be:

    Code:
    for(decimal d=decimal.Zero; d<things.Count; d+=decimal.One)
    {
    }

    Leave a comment:


  • DimPrawn
    replied
    Originally posted by thunderlizard View Post
    Obscure bit of .NET that I hadn't noticed in my many years of it:
    there are static members for decimal.One, decimal.Zero and decimal.MinusOne.

    Prudent of Microsoft to have reserved themselves the ability to adopt their own definitions of these numbers in future: but if they want to change any other numbers they're stuck.

    StackOverflow is normally great, but it struggles with this one:
    http://stackoverflow.com/questions/7...-minusone-in-c
    Don't tell me you've been using the plain vanilla 0,1 and -1 in your code!

    It's a bit like "" vs string.Empty

    It's readability for squinty eyed techies.

    Leave a comment:


  • thunderlizard
    started a topic Static decimal members

    Static decimal members

    Obscure bit of .NET that I hadn't noticed in my many years of it:
    there are static members for decimal.One, decimal.Zero and decimal.MinusOne.

    Prudent of Microsoft to have reserved themselves the ability to adopt their own definitions of these numbers in future: but if they want to change any other numbers they're stuck.

    StackOverflow is normally great, but it struggles with this one:
    http://stackoverflow.com/questions/7...-minusone-in-c

Working...
X