Doug McCallum writes: > >> revarp.c: 125: casts for malloc > > Is it necessary to have the cast here? The void pointer returned > > should be safe to assign without the cast? > It isn't really necessary and may just be my personal preference to > indicate you know what > type you are allocating.
I believe the standard practice for ON is the opposite: the cast is not required for void * returning functions (such as malloc), so it represents just visual clutter. The key issue is making sure that you're actually allocating the correct amount of space, and it's unclear (to me, at least) whether requiring the cast helps or hurts much in that regard. If the underlying concern is that someone may change variable '*foop' from type 'struct bar' to 'struct blah', I'd think it'd be fairly unwise to make that change without considering changing the name of the variable as well (and that'd require a healthy visit of each place it's used). And the members likely won't be exactly the same, either. -- James Carlson, KISS Network <[EMAIL PROTECTED]> Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084 MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677 _______________________________________________ networking-discuss mailing list [email protected]
