[ros-bugs] [Bug 5343] New: Rearrange cast order in MAKEINTRESOURCE

ReactOS.Bugzilla at reactos.org ReactOS.Bugzilla at reactos.org
Mon May 3 20:04:20 CEST 2010


           Summary: Rearrange cast order in MAKEINTRESOURCE
           Product: ReactOS
           Version: TRUNK
          Platform: x86 Hardware
        OS/Version: ReactOS
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: Other
        AssignedTo: ros-bugs at reactos.org
        ReportedBy: love.nystrom at gmail.com
         QAContact: ros-bugs at reactos.org

Created an attachment (id=4984)
 --> (http://www.reactos.org/bugzilla/attachment.cgi?id=4984)
Rearrange cast order in MAKEINTRESOURCE

This is not really a bugfix per se, but 
it fixes a lot of build warnings with GCC 4.4+.

In include\psdk\winuser.h (47065) Lines 585-586:
The patch rearranges the cast order in MAKEINTRESOURCEA,
and MAKEINTRESOURCEW. The reason is that the current definition
causes a lot of unnecessary build warnings.

We all know that INT resource identifiers are string pointers that
use only the low 16 bits. However, with resource identifiers of the
form MAKEINTRESOURCE(5), the constants are interpreted as int, and
therefore >16 bits.

The new GCC gets rightly worried when told to cast an INT or another
32 bit value to a WORD, because of the size difference. By casting to
ULONG first, and WORD secondly (to mask away the high part), the compiler
stays happy, and no compiler minds upcasting WORD to LPSTR/LPWSTR, because
the target is bigger than the source.

Best Regards

Configure bugmail: http://www.reactos.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the Ros-bugs mailing list