pdf-devel
[Top][All Lists]
Advanced

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

Re: [pdf-devel] Patch for FS#93 stack based iterators


From: Michael Gold
Subject: Re: [pdf-devel] Patch for FS#93 stack based iterators
Date: Wed, 28 Jan 2009 00:25:25 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, Jan 27, 2009 at 19:14:35 -0800, address@hidden wrote:
>  > > OTOH, I'm really against assertions in code. I consider it a serious 
> desi=
>  > gn
>  > > flaw.
>  > 
>  > Why?
> 
> They cause the program to abort instead of giving the chance to handle the
> error.

There's no sensible way to handle something like a badly-defined struct,
though. In this case a unit test works just as well, since it doesn't
depend on any runtime state, but it seems reasonable to use asserts for
other problems that can only be caused by programmer error -- they
produce messages that are useful to programmers (rather than crashes or
undefined behaviour), and are easily disabled by defining NDEBUG.

> So, let's sum up. We use a 'void*' and add a test case with a:
> assert(sizeof(gl_itr)<=sizeof(our_itr))

Yes, but if it's in a unit test, fail_unless can be used instead of
assert.

> Any other suggestion ?

I can't think of anything else now.

-- Michael

Attachment: signature.asc
Description: Digital signature


reply via email to

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