Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: WHICH ONE IS FASTER
|
Posted: Mar 11, 2003 12:01 PM
|
|
The casting method will be slightly slower, but it is inconsequential compared to any calculation you'll be doing. In other words, it scarcely matters, performance wise.
However, the whole purpose for being able to specify the type of literals with the suffixed letter is so you can do things like "long l1 = 0L;", whereas casting is normally used in cases where it is really needed. So not only is this syntax faster, but it is the correct one to use for initialization.
By the way, in this particular case "long l3 = 1;" works just fine, so the whole point is somewhat moot.
|
|