• Post Reply Bookmark Topic Watch Topic
  • New Topic

interesting narrowing conversion  RSS feed

 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
byte b = (int)16.2;
It is legal. So does casting operator return compile time constant, in this case of course?

double d = 10;
byte b = (int)d; //illegal
 
Henry Wong
author
Sheriff
Posts: 22861
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is legal. So does casting operator return compile time constant, in this case of course?


Casting a compile time constant, results in a compile time constant.

Henry
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every day I learn something more
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lukas Smith wrote:Every day I learn something more


Of course, we are learning(improving) everyday
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!