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: gerel
Subject: Re: [pdf-devel] Patch for FS#93 stack based iterators
Date: Tue, 27 Jan 2009 19:14:35 -0800 (PST)

 > Date: Tue, 27 Jan 2009 21:25:48 -0500
 > From: Michael Gold <address@hidden>
 > Content-Disposition: inline
 > 
 > >  > We should also verify
 > >  >        sizeof(pdf_list_iterator_s) >=3D3D sizeof(gl_list_iterator_t)
 > >  >        and sizeof(pdf_hash_iterator_s) >=3D3D sizeof(gl_list_iterator_=
 > t)
 > >  >=20
 > >  > Is there a portable way to do this at compile time? If not, assertions
 > >  > could be used in pdf_{list,hash}_iterator.
 > >=20
 > > If it is, then we can just use the gl real size. :-)
 > 
 > > BTW, I didn't use sizeof() on gl_list because that way we need to make
 > > gnulib implementation public. :-/
 > 
 > I think you're referring to sizing gl_itr based on
 > sizeof(gl_list_iterator_t) -- if so, you're right that this won't work.
 > 
 > What I meant was verifying those conditions in our private code (not the
 > public header file), as a sanity check.

Right, I see.

 > > 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. But if the asserts would fail at compile-time or in the test suite at
run-time then I have no problem with them.


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

Any other suggestion ?

regards,

-gerel




reply via email to

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