bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] Re: avoid using casts whenever possible [Re: gnulib/lib


From: Jim Meyering
Subject: Re: [Bug-gnulib] Re: avoid using casts whenever possible [Re: gnulib/lib error.c
Date: Tue, 30 Sep 2003 22:28:23 +0200

Bruno Haible <address@hidden> wrote:
...
> For the .c parts of gnulib, I agree. But the .h header files need to
> be usable from within C++, otherwise things like Windows DLLs become
> much harder to use.
...
>> > One uses the XMALLOC macro in the form it was before Paul's
>> > 2003-07-22 patch.
>>
>> (Just for the record: I installed that patch, but it was Jim's idea.  :-)
>
> Still I'd like to ask for reversal of that patch, for the reasons cited
> above: improved compile-time type checking.
>
>> I don't like XMALLOC (either the
>> old or the new form), because it is a function-style macro but it does
>> not behave like a function.  I think we should get rid of it, even if
>> we lose a bit of compile-time type-checking thereby.  (And I don't say
>> this lightly: I'm a big fan of compile-time checking.)
>
> I'm not using XMALLOC myself either, currently, because I believe that
> even with hand-written casts I don't make terrible mistakes. But it is
> Jim's and your argument that as few hand-maintained casts as possible
> is best, to reduce the opportunities for wrong casts; and therefore my
> plea to keep this macro in its useful form.

I don't feel very strongly about this particular case,
since these casts are somewhat of an exception.  So I don't
mind if they're restored.

It seems to me that most _uses_ of XMALLOC would be in source files,
not headers, so I don't see how this would help much with C++.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]