Online Books:
java.net on MarkMail:
Search |
||
JDK7 new numeric litteral formatsPosted by forax on September 24, 2009 at 5:07 AM PDT
The second small change from coin project, new numeric litterals has been integrated to jdk7/tl workspace and will be soon promoted into jdk7 main workspace. The patch introduces two new notations for numeric litterals:
int value = 0b11111111_00000000_11111111_00000000;
Cheers, Rémi »
Related Topics >>
Blogs Comments
Comments are listed in date ascending order (oldest first)
Merveilleuse nouvelle !
Submitted by efl on Fri, 2009-09-25 07:46.
Super Rémi merci !
And what about the suffix type specifiers ? y for byte and s for short, as there is already l for long.
0xFFy == (byte)-1Are those already included or planed for a future inclusion ? efl, The byte and short
Submitted by brucechapman on Fri, 2009-09-25 18:53.
efl,
The byte and short suffixes are still under consideration for exactly how it is done. But yes they will be in some time in the (JDK7) future and in some form, probably per your examples. I am holding it up, due to a lack of time resource due to a family crisis. It will happen.
Cool, what about type suffix on constantes ?
Submitted by bjb on Fri, 2009-09-25 10:07.
Bonjour Rémi,
I realy like the Ob syntax :)
Could it be possible to have another small one on the same area : "ordinal type suffix" on constants for all the simple types.
You know L indicates long as by default ordinal type is int, but there is no direct way to indicate the type on byte and short
So at this time, this does not compile :
public void add2( ){
add(0);
}
public void add( short value){
}
Why not permit S for short and B for byte at the end of a constant as well ?
But with the suffix indicating the type, if I write :
public void add2( ){
add(0S);
}
public void add( short value){
}
A+
JB
|
||
|
|
Very good to know!