Make topic const
bertmelis opened this issue · 4 comments
I'd like to propose a breaking change: make the topic in the onMessage callback const
.
Under the hood the topic is indeed a char*
but the end user shouldn't change the contents. I don't think there's a reason to anyway, but still...
+1 for this. I also suggest that the payload
should be of type const uint8_t *
instead of plain char *
which is little confusing for newbies.
+1. I typically add const everywhere. And yes to using the uint8_t instead of char. Maybe worth running the code through cppcheck/clangtidy or a service like codacy to see what other minor changes we could add?
+1 for this. I also suggest that the
payload
should be of typeconst uint8_t *
instead of plainchar *
which is little confusing for newbies.
Yes, that would also be better indeed.
+1 for both changes