VirtualBox

Changeset 9396 in vbox


Ignore:
Timestamp:
Jun 4, 2008 5:47:52 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
31629
Message:

type promotion warning for 64-bit. (Hope it's correctly formulated.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/VBox-CodingGuidelines.cpp

    r8155 r9396  
    186186 *      - Take care and use size_t when you have to, esp. when passing a pointer
    187187 *        to a size_t as a parameter.
     188 *
     189 *      - Be wary of type promotion to (signed) integer. For example the
     190 *        following will cause u8 to be promoted to int in the shift, and then
     191 *        sign extended in the assignment 64-bit:
     192 *        @code
     193 *              uint8_t u8 = 0xfe;
     194 *              uint64_t u64 = u8 << 24;
     195 *              // u64 == 0xfffffffffe000000
     196 *        @endcode
    188197 *
    189198 *
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette