You will need to cast the NULL to (std::uint8_t*) as well.
Yes, there is something different between the two languages. C++ enforces more type safety. ANSI C is more lenient and will implicitly cast typed pointers to void* and vice versa. One of the classic examples is using malloc. In C you can do the following:
char* pString = malloc(128);
However C++ would complain that you are trying to place a void* pointer into a char* pointer and you would need an explicit cast:
char* pString = (char*) malloc(128);
NOTE: C++ has the new operator which can be used instead of malloc and it returns the type of its operand and not just void* (It also calls the necessary constructors.)
Hi there,
my C is pretty rusty so I felt this question was better suited to 'Hello World!' rather than the main forum. I'm currently porting an application I've hacked from the LPCXpresso examples. It compiles under the Code Red Suite and I want to port it to mbed.
I have the following code which is used to set up the callbacks for the various USB endpoints:
and I'm getting the following errors from the mbed compiler:
Quote:
"A value of type "void *" cannot be used to initialize an entity of type "void (*const)(std::uint32_t)" (E144)
Any pointers (boom boom) about how to modify this for the mbed compiler?
Thanks.