This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to suppress errors in g++


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]