3 ms·
> we can't just replace broken pieces of code with the same simplicity we can replace a broken fridge. Sure we can. Recompile glibc, dynamic linking, pow. I
by camgunz 10y ago
> we can't just replace broken pieces of code with the same simplicity we can replace a broken fridge.
Sure we can. Recompile glibc, dynamic linking, pow.
I wouldn't say that bug you referenced is a strike against C; it could happen in any language that was locale-aware and parsing floats.
For what it's worth, these macros in libcperciva are perfectly readable and maintainable:
#define ELASTICARRAY_DECL(type, prefix, rectype) \
static inline struct prefix##_struct * \
prefix##_init(size_t nrec) \
{ \
struct elasticarray * EA; \
\
EA = elasticarray_init(nrec, sizeof(rectype)); \
return ((struct prefix##_struct *)EA); \
} \
...
The advice should really be "be careful, it's really easy to write shitty macros, so don't".
- mfukar 10y ago> Sure we can. Recompile glibc, dynamic linking, pow. Oh, so I have to maintain glibc. That's the alternative, we are in complete agreement. > I wouldn't say that bug you referenced is a strike against C; it could happen in any language that was locale-aware and parsing floats. I was responding to a very specific (and pointed) question. > For what it's worth, these macros in libcperciva are perfectly readable and maintainable: I'm not contesting that, they might be. The one you list looks fine at a glance, but that doesn't prove anything.