简体   繁体   中英

Advantage of initialization variable to Hexadecimal

I am working on a hash function coded in c++ and i was wondering why main constant variables are initialized with hex value. Like

unsigned long i= 0x428a2f98 ;

Is this done for the sake of performance if yes than please explain, because i think it have be converted to integer value at some point.

The way constants defined in the source code does not do anything for performance, as it will be converted to binary representation by compiler. It is there only for readability, for example binary data can be easier interpreted in hex than decimal notation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM