Skip to main content
10 events
when toggle format what by license comment
Dec 10, 2015 at 10:14 vote accept Ziezi
Dec 7, 2015 at 15:20 comment added Ziezi @Mat, fair enough :)
Dec 7, 2015 at 15:12 comment added Mat @simplicisveritatis: that cast offers zero type safety. But feel free to keep it - in this specific case it doesn't hurt. Keep in mind the others though (stated in the SO link).
Dec 7, 2015 at 14:56 comment added Ziezi @Mat, I see your point and I agree, on the other side, by doing this simple cast you ensure some type safety and the reader gets some information about the type of the buffer.
Dec 7, 2015 at 14:51 comment added Barry @Mat I still prefer to cast, even though you don't need to.
Dec 7, 2015 at 14:48 comment added Mat @simplicisveritatis: then you're not using a C compiler, or your IDE is trying to be too helpful and ends up being counter-productive. See stackoverflow.com/questions/605845/….
Dec 7, 2015 at 14:46 comment added Ziezi @Mat, it gets underlined in red if I don't cast to char*explicitly.
Dec 7, 2015 at 14:45 comment added Ziezi @Barry , I appreciate your remarks, I will skip the wrapping function increase_buffer_size() and include an additional line after the call torealloc(), to check whether buffer_pointer is the nullptr, together with some error message, if it is.
Dec 7, 2015 at 14:20 comment added Mat This is C, you don't need the cast at all. (Not needed for malloc either.)
Dec 7, 2015 at 14:00 history answered Barry CC BY-SA 3.0