Re: "const void * const"
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Thu, 1 Sep 2005 19:07:11 -0400
Microsoft <rich44@xxxxxxxxx> wrote:
> Could someone explain this snippet of code for me please.
>
> LRESULT (*) ( void * const, const void * const,
> ... ))MultiplyRealArrayByRealScalar,
>
> specifically what is a " const void * const
> "
A const pointer to a const pointee. That is, you cannot make the pointer
point to something else, nor can you modify the contents of the
pointed-to memory.
In contrast: const void* p is a non-const pointer to const pointee: you
can assign to p to make it point to something else, but no matter what
it points to, you cannot modify the pointed-to memory through p.
Similarly, void* const p is a const pointer to non-const pointee: you
cannot make it point to anything else, but you can say use memcpy to put
new contents into pointed-to memory.
> I can remove the code between the quotes below and the program
> compiles and runs normally.
> "( void * const, const void * const, ... )"
>
> What is that section of code between the quotes supposed to do?
Hard to say really, since the original example is syntactically
incorrect. An overabundance of closing parens is particularly confusing.
Post the code exactly as it is in your program.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- Re: "const void * const"
- From: Microsoft
- Re: "const void * const"
- References:
- "const void * const"
- From: Microsoft
- "const void * const"
- Prev by Date: Visual C++ Library...CRT Not Initialized
- Next by Date: Re: "const void * const"
- Previous by thread: "const void * const"
- Next by thread: Re: "const void * const"
- Index(es):
Relevant Pages
|