Hacker News new | ask | show | jobs
by pjmlp 452 days ago
It is a return to the age when we had BASIC and Z80/6502 Assembly, and yes doing memcpy/strcpy all over the place instead of having proper arrays and strings is that bad.

At very least, C++.

"C++14 For The Commodore 64"

https://www.youtube.com/watch?v=nLv_INgaLq8

1 comments

> doing memcpy/strcpy all over the place instead of having proper arrays and strings is that bad

This presupposes that you're doing string manipulation and raw memory moves. I don't know about other people's code, but in my own experience neither of those things are likely to be happening in embedded code. You're much more likely to pre-allocate all your memory, and use zero-copy patterns where ever possible. I never used a C-string in relation to talking to peripherals (i2c, spi, register mapped) or when doing dsp. Moreover, if you do need to use memcpy it's probably because you are doing something very low level for which memcpy is the best choice.

What is embedded nowadays was a home computer in 1980's, so maybe you aren't, as someone that started coding on a Timex 2068, I very much doubt that in general.

MISRA and similar exists for a reason.