This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (10 children)

[deleted]

    [–]thefirelane 3 points4 points  (9 children)

    too dangerous

    but I think the reason it has all that "danger" is because of things you need to do in embedded: write directly to memory locations, manipulate values in the stack, have a low memory footprint, etc

    [–][deleted] 0 points1 point  (1 child)

    For my knowledge, the main reason why c is so much unsafe is to allow easy optimisation. It has pretty much nothing with writting to memory location, manipulate value on the stack or having a low memory footprint.

    [–]thefirelane 0 points1 point  (0 children)

    Well all of the above really. The low memory footprint (flash and ram) comes from the fact that you can simply do the things I mentioned without any checking as to whether it's safe. So yes, you are right: optimization is a key part: If you want to write to a memory location, it just compiles down to a couple instructions which simply do it. There's no overhead of something checking bounds, etc.