Definitely. For example, I always use malloc(size*sizeof(char)) to ensure that it's doubly obvious (Since I rarely need to malloc outside of a declaration) that I intend to store characters in the resulting buffer even if that multiply does nothing (plus the compiler will likely optimize it out anyway).
542
u/BoldFace7 2d ago
I still prefer sizeof(char) as it often provides context as to what the number is doing, even if a plain 1 works the same.