what are the most common bugs in your D apps?
Denis Koroskin
2korden at gmail.com
Sun Apr 12 09:46:59 PDT 2009
On Sun, 12 Apr 2009 20:46:37 +0400, Nick Sabalausky <a at a.a> wrote:
> "Jarrett Billingsley" <jarrett.billingsley at gmail.com> wrote in message
> news:mailman.1145.1239546503.22690.digitalmars-d at puremagic.com...
> On Sun, Apr 12, 2009 at 9:28 AM, bearophile <bearophileHUGS at lycos.com>
> wrote:
>>
>> Your C code also contains a bug, if chars are unsigned.
>>
>> I will agree, however, that the D compiler (*all* compilers for all
>> languages, really!) should detect and complain about "nontrivial
>> trivial" comparisons - comparisons that *look* nontrivial (like "c >=
>> 0"), but which always evaluate to true or always to false.
>
> I agree with what you're saying about "nontrivial trivial comparisons",
> but
> I'm inclined to also suggest that arithmetic operations be disallowed for
> char types. It doesn't make any more semantic sence than trying to add a
> string with an int. Plus, the concept of signed/unsigned for a
> "character"
> is rather nonsensical as well.
>
> If you want to manipulate chars like that, you're not really looking to
> manipulate the characters themselves, you're looking to manipulate the
> underlying numerical codes. So a cast to a numeric type should be
> required.
>
>
I second that.
More information about the Digitalmars-d
mailing list