• Post Reply Bookmark Topic Watch Topic
  • New Topic

NX: Flag help

 
Jim Thompson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The INVALID flag for a deleted record is 0X8000, which is 32768. A short in Java goes to 32767. This flag is 2 bytes in the database. Shouldn't it be a int, using 4 bytes; the compiler won't take this:
private static final short INVALID = 0X8000;
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jim,
Try this:

Regards,
Phil.
 
Jim Thompson
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Why isn't the flag an int instead of a short? Why 2 bytes?
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jim,
Originally posted by Jim Thompson:
Why isn't the flag an int instead of a short? Why 2 bytes?

Why even two bytes? It should be one byte (as it was in the database file I had for my assignment). Actually a flag can be represented in a single bit, so even a single byte is ample. I suspect they vary the size of the flag so that there are different versions of the assignment. I guess this is so one can't just take a solution to one of the assignment versions and have it work correctly with the database file from another version.
 
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!