Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I find this problem exacerbated by using a lot of primitive types, and ameliorated (though not eliminated) by wrapping things in context-specific single element structs.

Given:

    int price, quantity;
compare

    place_order(price, quantity);
with

    {
        price_t px = { price };
        quantity_t qx = { quantity };

        place_order(qx, px);
    }

More verbose (especially where, like above, the values weren't already wrapped), but catches a significant error.

It does not permit reordering arguments like the struct approach does, and doesn't help where you have multiple arguments of the same type that it is unreasonable to distinguish.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: