ListView_InsertColumn() question
Can you verify something for me, please? The SDK declares ListView_InsertColumn() as: int ListView_InsertColumn( HWND hwnd, int iCol, const LPLVCOLUMN pcol ); In commctrl.h, we have: #define ListView_InsertColumnA(hwnd,iCol,pcol) \ (INT)SNDMSGA((hwnd),LVM_INSERTCOLUMNA,(WPARAM)(INT)(iCol),(LPARAM)(const LVCOLUMNA *)(pcol)) #define ListView_InsertColumnW(hwnd,iCol,pcol) \ (INT)SNDMSGW((hwnd),LVM_INSERTCOLUMNW,(WPARAM)(INT)(iCol),(LPARAM)(const LVCOLUMNW *)(pcol)) #define ListView_InsertColumn WINELIB_NAME_AW(ListView_InsertColumn) Given (for a type T) that const T * and T const * are equivalent, and given the left-to-right nature of pointer declarations, am I not right in thinking that const LPLVCOLUMN pcol is really equivalent to: LVCOLUMN * const pcol; not const LVCOLUMN *pcol; ? Thanks, -- Andy.
[I meant to say that pointer declarations are read right-to-left, not left-to-right. So the corrected question is:] Can you verify something for me, please? The SDK declares ListView_InsertColumn() as: int ListView_InsertColumn( HWND hwnd, int iCol, const LPLVCOLUMN pcol ); In commctrl.h, we have: #define ListView_InsertColumnA(hwnd,iCol,pcol) \ (INT)SNDMSGA((hwnd),LVM_INSERTCOLUMNA,(WPARAM)(INT)(iCol),(LPARAM)(const LVCOLUMNA *)(pcol)) #define ListView_InsertColumnW(hwnd,iCol,pcol) \ (INT)SNDMSGW((hwnd),LVM_INSERTCOLUMNW,(WPARAM)(INT)(iCol),(LPARAM)(const LVCOLUMNW *)(pcol)) #define ListView_InsertColumn WINELIB_NAME_AW(ListView_InsertColumn) Given (for a type T) that const T * and T const * are equivalent, and given the right-to-left nature of pointer declarations, am I not right in thinking that const LPLVCOLUMN pcol is really equivalent to: LVCOLUMN * const pcol; not const LVCOLUMN *pcol; ? Thanks, -- Andy.
"Andrew Talbot" <Andrew.Talbot(a)talbotville.com> wrote:
Given (for a type T) that const T * and T const * are equivalent, and given the right-to-left nature of pointer declarations, am I not right in thinking that const LPLVCOLUMN pcol is really equivalent to:
LVCOLUMN * const pcol;
not
const LVCOLUMN *pcol;
?
I think yes. A simple test with MSVC compiler and gcc confirms that as well. -- Dmitry.
"Dmitry Timoshkov" <dmitry(a)codeweavers.com> wrote:
"Andrew Talbot" <Andrew.Talbot(a)talbotville.com> wrote:
Given (for a type T) that const T * and T const * are equivalent, and given the right-to-left nature of pointer declarations, am I not right in thinking that const LPLVCOLUMN pcol is really equivalent to:
LVCOLUMN * const pcol;
This one is an equivalent of 'LPLVCOLUMN pcol';
not
const LVCOLUMN *pcol;
?
I think yes. A simple test with MSVC compiler and gcc confirms that as well.
Sorry for the ambiguous answer, I missed "not" in "am I not", and it slightly confused me, leading to an inversed logic in thinking. -- Dmitry.
Dmitry Timoshkov wrote:
Sorry for the ambiguous answer, I missed "not" in "am I not", and it slightly confused me, leading to an inversed logic in thinking.
I should have made the question less verbose. :) I think we are agreeing that LVCOLUMN * const pcol; is the correct equivalent of const LPLVCOLUMN pcol; So it would seem that I need to patch commctrl.h, and this should also have a significance for the cast-qual warning I get for taskmgr/column.c. Thanks, Dmitry! -- Andy.
participants (2)
-
Andrew Talbot -
Dmitry Timoshkov