Skip to Content
Hands-On Embedded Programming with C++17
book

Hands-On Embedded Programming with C++17

by Maya Posch
January 2019
Intermediate to advanced
458 pages
10h 35m
English
Packt Publishing
Content preview from Hands-On Embedded Programming with C++17

Strongly typed

Type information is necessary to test for proper access to and interpretation of data. A big feature in C++ that's relative to C is the inclusion of a strong type system. This means that many type checks performed by the compiler are significantly more strict than what would be allowed with C, which is a weakly typed language.

This is mostly apparent when looking at this legal C code, which will generate an error when compiled as C++:

void* pointer; 
int* number = pointer; 

Alternatively, they can also be written in the following way:

int* number = malloc(sizeof(int) * 5); 

C++ forbids implicit casts, requiring these examples to be written as follows:

void* pointer; 
int* number = (int*) pointer; 

They can also be written in ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RTOS with Microcontrollers

Hands-On RTOS with Microcontrollers

Brian Amos

Publisher Resources

ISBN: 9781788629300Supplemental Content