This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to suppress errors in g++
- From: Andrew Haley <aph at redhat dot com>
- To: Hani Ayoub <hani dot ayoub at live dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 04 Dec 2008 14:55:06 +0000
- Subject: Re: How to suppress errors in g++
- References: <20834772.post@talk.nabble.com>
Hani Ayoub wrote:
> When I try to compile my code in g++ I get many of the following error:
> invalid conversion from `void*' to `<somthing>'.
>
> My question is: How can I suppress this error?
> And, shouldn't this message be a Warning and not an Error?
To quote the standard, C.1.2 Clause 3:
Change: Converting void* to a pointer-to-object type requires casting
char a[10];
void *b=a;
void foo() {
char *c=b;
}
ISO C will accept this usage of pointer to void being assigned to a pointer
to object type. C++ will not.
Rationale: C++ tries harder than C to enforce compile-time type
safety.
Andrew.