VC++.NET 2003 should not issue C4090 ompiler warning in the following case
From: John Smith (johnsmith_smith_at_caramail.com)
Date: 08/03/04
- Next message: Victor Bazarov: "Re: what's the meaning of the following expression?"
- Previous message: Craig Bumpstead: "Re: DAMAGE message on free()"
- Next in thread: Doug Harrison [MVP]: "Re: VC++.NET 2003 should not issue C4090 ompiler warning in the following case"
- Reply: Doug Harrison [MVP]: "Re: VC++.NET 2003 should not issue C4090 ompiler warning in the following case"
- Messages sorted by: [ date ] [ thread ]
Date: 2 Aug 2004 21:12:50 -0700
Hi,
I would like to understand what's going on here:
const void *foo[10];
void bar(void)
{
// issues warning C4090: 'function' : different 'const' qualifiers
memset(foo, 0, sizeof(const void *) * 10);
}
Why does the VC++ compiler (7.1.3088) issue a warning here? The foo
array is not declared constant. Only the cell of the array is of type
const void *.
This is my first question.
Now, if I replace the code with:
typedef void *MYTYPE;
typedef const MYTYPE MYCONSTTYPE;
MYCONSTTYPE foo[10];
memset(foo, 0, sizeof(const void *) * 10);
then no warning is issued, although the code looks quite identical.
How is this possible?
- Next message: Victor Bazarov: "Re: what's the meaning of the following expression?"
- Previous message: Craig Bumpstead: "Re: DAMAGE message on free()"
- Next in thread: Doug Harrison [MVP]: "Re: VC++.NET 2003 should not issue C4090 ompiler warning in the following case"
- Reply: Doug Harrison [MVP]: "Re: VC++.NET 2003 should not issue C4090 ompiler warning in the following case"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|