New answers tagged

4 votes
Accepted

Custom Memory Allocator - How to find the required alignment for a platform?

malloc is required to return a pointer properly aligned to hold an object of any type. Which means it must be aligned at least as the largest scalar type. Luckily C ...
user avatar
  • 9,667
5 votes
Accepted

Drivers in C++ produces bigger assembly

First the question is, why does the class produces bigger assembly? You just introduced a class! That means you get longer method names (keyword: name mangling), if you're building with such embedded ...
user avatar
0 votes

Drivers in C++ produces bigger assembly

It really depends on the quality of the optimizer (auto inlining especially) and the fact that in the first case you can easily fit x in a register in the calling sequence while in a class you need a ...
user avatar
2 votes

Noise reduction algorithm for an AC mains voltage measurement

I am sampling the 50 Hz sine wave at 20 points Depending whereabouts the first sample lies and the 20th sample lies on the sampled waveform, can produce errors of this magnitude. A much higher ...
user avatar
  • 385k
3 votes

Confusion with variable update in microcontroller programming

As pointed out by @EugeneSh, your sprintf line will overflow the msg_int buffer whenever ...
user avatar
  • 13.3k

Top 50 recent answers are included