Re: pass-by-value const is part of function type signature?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Where can I submit a bug report? The error message itself is sufficient
evidence of the bug.

error C2664: 'CSVForEach' : cannot convert parameter 2 from 'HRESULT
(__stdcall *)(const unsigned short)' to 'HRESULT (__stdcall *)(unsigned
short)'

Note that I tried to make a simpler test case, and if I remove the class and
make global functions VC++ behaves:

#include <windows.h>

HRESULT CSVForEach( const char* const szCSV, HRESULT (CALLBACK
*pfnUseCount)(unsigned short), HRESULT (CALLBACK *pfnDoIter)(unsigned short,
const char*, unsigned short) );
HRESULT CALLBACK ConfigureCount( const unsigned short nMSIDs )
{
return 0;
}

HRESULT CALLBACK ConfigureEach( const unsigned short iMSID, const char*
const szMSID, const unsigned short l )
{
return 0;
}

struct ReaderISS
{
static HRESULT ConfigureReaders( const char* const szMSIDList )
{
return CSVForEach( szMSIDList, &ConfigureCount, &ConfigureEach );
}
};


"Victor Bazarov" <v.Abazarov@xxxxxxxxxxxx> wrote in message
news:ug%23KsPGGGHA.3036@xxxxxxxxxxxxxxxxxxxxxxx
> Ben Voigt wrote:
>> Usually in function implementations, I make the local copy of arguments
>> const in order to have the compile check for attempts to change them.
>> This isn't reflected in the prototype -- there's no need for it to be and
>> it just confuses important things like argument names and whether the
>> object of the pointer is const.
>
> "Top-level" const qualifier of an argument is _not_ part of the function
> type. That's according to the Standard.
>
>> The GNU compiler suite handles this just fine.
> [...]
> There is always hope. You should submit a bug report.
>
>> [..]
>
> V


.



Relevant Pages

  • For the CComBSTR lovers
    ... does not move the BSTR memory to another location. ... unsigned int ByteLength() const throw ... HRESULT __cdecl Formatthrow{va_list args; ...
    (microsoft.public.vc.atl)
  • Re: For the CComBSTR lovers
    ... unsigned int ByteLength() const throw ... operator BSTR() const throw ... HRESULT __cdecl Formatthrow{va_list args; ...
    (microsoft.public.vc.atl)
  • Re: Deinterlace AVI
    ... const AMOVIESETUP_MEDIATYPE sudMediaTypes = { ... HRESULT CMyFilter3a::CheckTransform(const CMediaType* mtIn, const ... return NOERROR; ...
    (microsoft.public.multimedia.directx.dshow.programming)
  • I Cant register the custom directshow filter in debug entironment on Windows Mobile 5.0 device
    ... These exports are necessary in order for com to register the filter ... CSampleGrabber(LPUNKNOWN pUnk, HRESULT *phr); ... HRESULT CheckMediaType(const CMediaType *pMT); ... // this is needed for COM to register the component with RegSvr ...
    (microsoft.public.pocketpc.developer)