On Mon, Feb 08, 2016 at 02:26:29PM +1000, Stuart Longland wrote: > On 08/02/16 12:17, David Gibson wrote: > >> +static void* default_malloc(const struct btree_allocator* alloc, size_t > >> size); > > Existing style in this function suggests "void *foo" rather than > > "void* foo". > > Ahh, call it habit, I'm used to having the "pointer" bit with the type > (as to me; "pointer to void" is a distinct type from "void"). Caught > myself doing it elsewhere but missed it here, I'll fix it.
So, from a language design point of view, I agree with you. However,
I dislike that style in C because it obscures the fact that C
importantly *does not* have that sensible handling of types.
More specifically this style:
int* a, b;
Suggests that a and b have the same type, but of course they don't.
> > [snip]
> >> > +/* Default allocator implementation */
> >> > +const struct btree_allocator BTREE_DEFAULT_ALLOCATOR = {
> > Use of all-caps for a non-macro is a bit unexpected.
> >
>
> Good point. I guess I wanted to visually differentiate a constant from
> other member types.
I applaud the idea, but unfortunately I don't think that use of caps
is common enough to make it really clear.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
_______________________________________________ ccan mailing list [email protected] https://lists.ozlabs.org/listinfo/ccan
