Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does '0xDEAD' mean in the following code?

There is an enum structure,but I don't understand the meaning of '0xDEAD - 2' in this enum.

enum TerminatedTypes {
    _not_terminated = 0xDEAD - 2,
    _thread_exiting,                            
    _thread_terminated,                          
    _vm_exited                                   
};

From the code above,What kind of benefit can I get?

The code above is in 'hotspot/src/share/vm/runtime/thread.hpp' in openjdk8.

I am studying source code of jdk,please help me.

like image 581
yangyixiaof Avatar asked Sep 09 '14 02:09

yangyixiaof


1 Answers

It's a hex literal, being used as an eyecatcher (useful in debuggers) so that the _thread_terminated value will be 0xDEAD ("terminated thread" equals "dead").

There's a host of hex literals people use for things like that, such as DEADBEEF from the Jargon file, and so on.

like image 177
paxdiablo Avatar answered Oct 19 '22 06:10

paxdiablo