Solved What is the significance of adding 'D' or 'L' after certain numbers?

Discussion in 'Plugin Development' started by Sulphate, Dec 19, 2016.

Thread Status:
Not open for further replies.
  1. Hello,

    I was wondering what the significance of adding D after a double or L after a long is. Is it needed? Or is it just convention?

    Thanks
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Sulphate Convention unless you just say 5d (without decimals)
    At least, I am only using it when I need it so that I don't start casting.
     
  3. @Sulphate
    As @timtower pointed out, it has some uses, especially for float and long, because the compiler automatically assumes it's double or int. What I do is if I use long or float numbers, I nearly always put the f or L on the end to indicate to anyone reading the code that it's a float/long. I rarely every use the D though.
     
Thread Status:
Not open for further replies.

Share This Page