Hi all,

Suppose I have a pointer that I want to pass through function parameters.
In the function, neither is the pointer reassigned, nor is the thing it
points to modified in any form.

So, I would assume its function argument signature to be like FAR const
struct my_struct * const ptr (The second "const" is my focus here).
Similarly for things like const uint8_t my_num, etc. as well.

However, I have not really seen much use of specifying constants using
const (in the way I have mentioned above). Most of the examples I see are
of FAR const struct my_struct * ptr. I have heard the compiler can make
better optimizations for const, and because of this, I try to spam const
anywhere and everywhere I can. But I don't see too many such usages across
the codebase, so I was wondering why that is (or I just maybe reading the
code wrong, in which case, forgive me 🙏).

Regards,
Saurav Pal.

Reply via email to