Re: gl_list API

2021-04-18 Thread Ben Pfaff
On Tue, Apr 6, 2021 at 1:30 PM Bruno Haible wrote: > Paul Eggert wrote: > > Yes, that would be portable. But that cast indicates another problem > > with the API. It should return void *, not void const * (think of strchr > > as the model here). > > strchr is a bad model here: You pass it a pointe

Re: gl_list API

2021-04-06 Thread Marc Nieper-Wißkirchen
Am Di., 6. Apr. 2021 um 23:04 Uhr schrieb Bruno Haible : > > > But when designing a general utility, for all kinds of programs to use, > > > it is inappropriate to say "storing null elements is not useful". > > > > I'm afraid we'll have to disagree here. > > In some of my uses of the gl_list modul

Re: gl_list API

2021-04-06 Thread Bruno Haible
> > But when designing a general utility, for all kinds of programs to use, > > it is inappropriate to say "storing null elements is not useful". > > I'm afraid we'll have to disagree here. In some of my uses of the gl_list module, the element is in fact a small integer, cast to an 'uintptr_t' an

Re: gl_list API

2021-04-06 Thread Paul Eggert
On 4/6/21 1:28 PM, Bruno Haible wrote: But when designing a general utility, for all kinds of programs to use, it is inappropriate to say "storing null elements is not useful". I'm afraid we'll have to disagree here. But then I don't use the API so my comments aren't all that important.

Re: gl_list API

2021-04-06 Thread Bruno Haible
Paul Eggert wrote: > > gl_list_iterator_next has to return two things: An element (represented by > > a const void *) and a boolean value. As elements may be NULL > > Ah, OK, then that's the problem. The API shouldn't allow null elements. > They're not that useful anyway. I disagree very much wi